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 Cocoa | |
let bounds = CGRectMake(0, 0, 100, 100); | |
func DrawImageInCGContext(#size: CGSize, #drawFunc: (context: CGContextRef) -> ()) -> NSImage { | |
let colorSpace = CGColorSpaceCreateDeviceRGB() | |
let bitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedLast.rawValue) | |
let context = CGBitmapContextCreate( |
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
// Let's define a basic Swift class. | |
class Fruit { | |
var type=1 | |
var name="Apple" | |
var delicious=true | |
} | |
// We can get at some info about an instance of an object using reflect(), which returns a Mirror. | |
reflect(Fruit()).count | |
reflect(Fruit())[1].0 |
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 AppKit | |
class PreferencesViewController: NSTabViewController { | |
private lazy var tabViewSizes: [NSTabViewItem: NSSize] = [:] | |
override func tabView(_ tabView: NSTabView, didSelect tabViewItem: NSTabViewItem?) { | |
super.tabView(tabView, didSelect: tabViewItem) | |
if let tabViewItem = tabViewItem { |
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/bash | |
function usage { | |
echo "Usage: $0 -c [CodeSign Directory] -p [Xcode Project File.xcodeproj]" | |
echo "If any arguments are not specified, defaults will be attempted. If defaults don't exist, script will exit." | |
echo "OPTIONS:" | |
echo " -c [CodeSign Directory]: Location of directory containing project's provisioning profiles." | |
echo " -p [Xcode Project File]: Path of Xcode project directory (the .xcodeproj, not .pbxproj)" | |
echo " -b: Use PlistBuddy command for UUID replacement instead of sed. (Better handling of a couple of edge cases, but makes diffs impossible to read.)" | |
echo " -v: Verbose logging." |
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
# List of environments and their heroku git remotes | |
ENVIRONMENTS = { | |
:staging => 'myapp-staging', | |
:production => 'myapp-production' | |
} | |
namespace :deploy do | |
ENVIRONMENTS.keys.each do |env| | |
desc "Deploy to #{env}" | |
task env do |
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
// | |
// GDILog.h | |
// GDILog | |
// | |
// Created by Grant Davis on 8/18/14. | |
// Copyright (c) 2014 Grant Davis Interactive, LLC. All rights reserved. | |
// | |
#ifdef DEBUG | |
#include <string.h> |
NewerOlder