This file contains 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 jan1 = Date(timeIntervalSince1970: 24*60*60) | |
let days = (0...11).map { | |
Calendar.current.date(byAdding: .month, value: $0, to: jan1)! | |
} | |
days | |
let daysPerMonth = days.map { |
This file contains 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 UIKit | |
import PlaygroundSupport | |
// Test site for Basic Authentication | |
// substitute values in the path to auth against | |
// http://httpbin.org/basic-auth/user/passwd | |
// so | |
// http://httpbin.org/basic-auth/foo/bar | |
// would check for username = foo and password = bar |
This file contains 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 UIKit | |
let appDelegateClass: AnyClass = NSClassFromString("AppNameTests.TestingAppDelegate") ?? AppDelegate.self | |
UIApplicationMain(Process.argc, Process.unsafeArgv, nil, NSStringFromClass(appDelegateClass)) |
This file contains 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 | |
class TestingAppDelegate: NSObject, NSApplicationDelegate { | |
} |
This file contains 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/Cocoa.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (NSClassFromString(@"AppNameTests.TestingAppDelegate") != nil) { | |
id appDelegate = [[NSClassFromString(@"AppNameTests.TestingAppDelegate") alloc] init]; | |
NSApplication * application = [NSApplication sharedApplication]; | |
[application setDelegate:appDelegate]; | |
[NSApp run]; | |
} else { |
This file contains 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/sh | |
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; | |
sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \; | |
sudo rm -rf /Library/Caches/com.apple.iconservices.store |
This file contains 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/env python | |
import os | |
import requests | |
import json | |
""" | |
bot configure note: | |
cd $XCS_SOURCE_DIR/project_dir/scripts/ | |
./bot2slack.py |
This file contains 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
// Enable iOS device to show up as AVCapture devices | |
// From WWDC video 2014 #508 at 5:34 | |
// https://developer.apple.com/videos/wwdc/2014/#508 | |
CMIOObjectPropertyAddress prop = { | |
kCMIOHardwarePropertyAllowScreenCaptureDevices, | |
kCMIOObjectPropertyScopeGlobal, | |
kCMIOObjectPropertyElementMaster }; | |
UInt32 allow = 1; | |
CMIOObjectSetPropertyData(kCMIOObjectSystemObject, &prop, 0, NULL, sizeof(allow), &allow); |
This file contains 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
// Playground - noun: a place where people can play | |
import UIKit | |
let 𝜋 = M_PI | |
let ɸ = (1 + sqrt(5))/2 | |
func drawTiles(tileCount: Int, height: Double, context: CGContext) { | |
let red = CGFloat(arc4random_uniform(100)) / 100.0 | |
let green = CGFloat(arc4random_uniform(100)) / 100.0 |