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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| int main(int argc, const char* argv[]) | |
| { | |
| char name[1024]; | |
| char buffer[150]; | |
| for (int i = 0; i < 100000; ++i) { |
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
| extension CustomDebugStringConvertible { | |
| public func debugDescription(excluding fields: [String]) -> String { | |
| let excluded = Set<String>(fields) | |
| let m = Mirror(reflecting: self) | |
| let arguments = m.children | |
| .filter { child in | |
| return (child.label == nil) || !excluded.contains(child.label!) | |
| } | |
| .map { c -> String in | |
| let value = (type(of: c.value) == String.self) ? "\"\(c.value)\"" : "\(c.value)" |
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 | |
| let username = "username" | |
| let password = "password" | |
| let base = "https://api.github.com" | |
| let user = "\(base)/user" | |
| let url = NSURL(string: user) | |
| let request = NSMutableURLRequest(URL: url!) |
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
| func objectsAtIndexes<T:AnyObject>(array: [T], indexes:NSIndexSet) -> [T] | |
| { | |
| return ((array as NSArray).objectsAtIndexes(indexes) as [T]) | |
| } |
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
| - (void)drawRect:(CGRect)rect { | |
| [[UIColor lightGrayColor] setFill]; | |
| [[UIColor darkGrayColor] setStroke]; | |
| UIBezierPath *path = [[UIBezierPath alloc] init]; | |
| CGPoint touchPoint = [self.lastTouch locationInView:self]; | |
| CGFloat y0 = self.bounds.origin.y; | |
| CGFloat weight = 0.75; // Vary from 0 - 1. Values closed to 1 are more pointy. | |
| CGFloat y1 = y0 + (touchPoint.y - y0) * weight; // between top of screen and touch | |
| CGFloat y2 = touchPoint.y; | |
| CGFloat y4 = CGRectGetMaxY(self.bounds); |
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
| OS X 10.10.1/Xcode 6.3 6D520o | |
| inu:Radars idz$ swiftc main.swift | |
| inu:Radars idz$ ./main -radar "is fixed" | |
| [radar: is fixed] |
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
| /* ==== KeychainItem.swift === */ | |
| public class KeychainItem { | |
| public var dictionary : KeychainDictionary | |
| public init() { | |
| self.dictionary = KeychainDictionary() | |
| } | |
| public init(dictionary: KeychainDictionary) { |
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
| class Foo | |
| { | |
| let a = "a" | |
| let b = "b" | |
| let c = "c" | |
| let values = [ "A", "B", "C", "D", "E" ] | |
| var rawValues: String | |
| { | |
| let a = self.a |
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 | |
| if [[ $BASH_SOURCE != $0 ]]; then echo "$BASH_SOURCE must be executed, not sourced."; return 255; fi | |
| # | |
| # A script to fool iOS playgrounds into allowing access to CommonCrypto | |
| # | |
| # The script creates a dummy CommonCrypto.framework in the SDK's System | |
| # Framework Library Directory with a module map that points to the | |
| # umbrella header | |
| # | |
| # Usage: |
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
| /* | |
| CommonHMac defines the following enumeration | |
| enum { | |
| kCCHmacAlgSHA1, | |
| kCCHmacAlgMD5, | |
| kCCHmacAlgSHA256, | |
| kCCHmacAlgSHA384, | |
| kCCHmacAlgSHA512, | |
| kCCHmacAlgSHA224 |