WWDC 2007 2008 2009 2010 2011 2012 2013 2014 2015
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 <Foundation/Foundation.h> | |
| #import <CoreAudio/CoreAudio.h> | |
| #import "utilities.h" | |
| /* | |
| This example demonstrates how to create an aggregate device using Core Audio in Objective-C. | |
| It creates an aggregate device with two sub-devices, which are the default input and output devices. | |
| */ | |
| int main(int argc, const char * argv[]) { |
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
| // Similar to defer in Swift | |
| #define pspdf_defer_block_name_with_prefix(prefix, suffix) prefix ## suffix | |
| #define pspdf_defer_block_name(suffix) pspdf_defer_block_name_with_prefix(pspdf_defer_, suffix) | |
| #define pspdf_defer __strong void(^pspdf_defer_block_name(__LINE__))(void) __attribute__((cleanup(pspdf_defer_cleanup_block), unused)) = ^ | |
| #pragma clang diagnostic push | |
| #pragma clang diagnostic ignored "-Wunused-function" | |
| static void pspdf_defer_cleanup_block(__strong void(^*block)(void)) { | |
| (*block)(); | |
| } | |
| #pragma clang diagnostic pop |
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
| .onDrop(of: [.fileURL], isTargeted: nil) { providers in | |
| if let loadableProvider = providers.first(where: { $0.canLoadObject(ofClass: URL.self) }) { | |
| _ = loadableProvider.loadObject(ofClass: URL.self) { fileURL, _ in | |
| if let fileURL = fileURL, fileURL.pathExtension.lowercased() == "zip" { | |
| self.logger.info("Dropped \(fileURL.path)") | |
| DispatchQueue.main.async { | |
| importer.open(zipArchiveURL: fileURL) | |
| } | |
| } | |
| } |
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 Foundation | |
| import CoreImage | |
| struct CPBitmap { | |
| var data: Data | |
| var bitmapRange: Data.Indices { | |
| data.startIndex ..< (data.endIndex - 24) | |
| } |
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
| /* | |
| Paste it to Xcode Playground | |
| */ | |
| import SwiftUI | |
| import PlaygroundSupport | |
| extension NSView { | |
| func cachedImageRepresentation() -> NSBitmapImageRep { |
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
| // | |
| // ContentView.swift | |
| // GestureTest | |
| // | |
| // Created by 김성민 on 2020/10/05. | |
| // | |
| import SwiftUI | |
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
| #!/usr/bin/python3 | |
| import subprocess | |
| brew_commands = subprocess.check_output(["brew", "ls"]).splitlines() | |
| result = [ command.decode('utf8') for command in brew_commands | |
| if len(subprocess.check_output(["brew", "uses", "--installed", command]).split()) == 0 ] | |
| print(*result) |
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
| ### for Tensorflow 2.0 | |
| import tensorflow as tf | |
| physical_devices = tf.config.experimental.list_physical_devices('GPU') | |
| assert len(physical_devices) > 0, "Not enough GPU hardware devices available" | |
| tf.config.experimental.set_memory_growth(physical_devices[0], True) | |
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
| struct FillingZip<Sequence1: Sequence, Sequence2: Sequence>: Sequence { | |
| private let sequence1: Sequence1 | |
| private let sequence2: Sequence2 | |
| init(_ sequence1: Sequence1, _ sequence2: Sequence2) { | |
| self.sequence1 = sequence1 | |
| self.sequence2 = sequence2 | |
| } |
NewerOlder