App Store Connect / Developer Insights / Tech Talks / WWDC07 / WWDC08 / WWDC09 / WWDC10 / WWDC11 /
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * MacEditorTextView | |
| * Copyright (c) Thiago Holanda 2020-2021 | |
| * https://twitter.com/tholanda | |
| * | |
| * MIT license | |
| * Modified by https://github.com/cjwcommuny for TextKit 2 | |
| */ | |
| import Combine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| extension View { | |
| /// Synchronizes the bindings so changes in any of them are propagated to the other. | |
| /// | |
| /// The following example shows how to synchronize a Published property in a view model with a Binding used for presenting a sheet: | |
| /// ``` | |
| /// class ViewModel: ObservableObject { | |
| /// @Published var isPresented = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Cocoa | |
| let loremIpsum = """ | |
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque erat risus, laoreet et eros id, lobortis elementum sem. Nullam nec magna massa. Donec gravida felis at odio tincidunt pretium et in orci. Curabitur suscipit porta purus non faucibus. Cras dapibus felis eu enim rutrum, vel aliquet lacus volutpat. Quisque fermentum vulputate dictum. Morbi mattis orci quis dui posuere, id vulputate turpis tempus. Sed vulputate augue at ullamcorper feugiat. Phasellus nec lacus eget sapien congue lacinia vel et nulla. Phasellus sollicitudin gravida dapibus. Donec molestie ullamcorper lacus eu rutrum. Praesent lacinia dignissim dui eu ultricies. Integer in lacus lobortis, porttitor sem eu, tincidunt dolor. Cras dignissim nisl in maximus ullamcorper. | |
| Proin nec vulputate magna. In interdum leo sit amet arcu consequat facilisis. Fusce ut malesuada ante, nec malesuada nisl. Mauris porta velit quis tortor mollis, in suscipit augue efficitur. Praesent eleifend mollis neque, non sempe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Erica Sadun, http://ericasadun.com | |
| Cross Platform Defines | |
| Apple Platforms Only | |
| Will update to #if canImport() when available | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Created by Matthew Johnson on 5/28/16. | |
| // Copyright © 2016 Anandabits LLC. All rights reserved. | |
| // | |
| // This is a minimalist implementation of a responder chain in pure Swift. | |
| // | |
| // It is not intended to demonstrate the best way to | |
| // implement event processing in Swift. | |
| // | |
| // The intent is to show how little code is necessary to acheive behavior | |
| // similar to Cocoa's responder chain in pure Swift. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # ----------------------- | |
| # | |
| # This is a script that installs docker-ce (Docker Community Edition) on Debian 9 | |
| # Inspired by https://gist.github.com/frgomes/a6f889583860f5b330c06c8b46fa0f42 | |
| # | |
| # ----------------------- | |
| # Pre-requesite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // selection range | |
| var range = window.getSelection().getRangeAt(0); | |
| // plain text of selected range (if you want it w/o html) | |
| var text = window.getSelection(); | |
| // document fragment with html for selection | |
| var fragment = range.cloneContents(); | |
| // make new element, insert document fragment, then get innerHTML! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get all *text* nodes contained in a selection object. | |
| // Adapted from code by Tim Down. | |
| // http://stackoverflow.com/questions/4398526/how-can-i-find-all-text-nodes-between-to-element-nodes-with-javascript-jquery | |
| function getTextNodesBetween(selection) { | |
| var range = selection.getRangeAt(0), rootNode = range.commonAncestorContainer, | |
| startNode = range.startContainer, endNode = range.endContainer, | |
| startOffset = range.startOffset, endOffset = range.endOffset, | |
| pastStartNode = false, reachedEndNode = false, textNodes = []; | |
| function getTextNodes(node) { | |
| var val = node.nodeValue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.getElementsByTagName('button')[0].onclick = function () { | |
| scrollTo(document.body, 0, 1250); | |
| } | |
| function scrollTo(element, to, duration) { | |
| var start = element.scrollTop, | |
| change = to - start, | |
| currentTime = 0, | |
| increment = 20; | |
NewerOlder