- Big Nerd Ranch Blog (feat. Mark Dalrymple)
- iOS Dev Weekly (mailing list)
- NSHipster
- WWDC Videos
- iOS Programming Guide
- objc.io
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 AppDelegate: NSObject, NSApplicationDelegate { | |
@IBOutlet var window: NSWindow | |
@IBOutlet var label: NSTextField | |
func applicationDidFinishLaunching(aNotification: NSNotification?) { | |
// Insert code here to initialize your application | |
} |
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
extension NSView { | |
func insetSubview(subview: NSView, dx: CGFloat, dy: CGFloat) { | |
addSubview(subview) | |
subview.translatesAutoresizingMaskIntoConstraints = false | |
let constrain = { (attribute: NSLayoutAttribute, constant: CGFloat) in | |
subview.addConstraint(NSLayoutConstraint( | |
item: subview, | |
attribute: attribute, | |
relatedBy: .Equal, |
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
public class IdentifierGenerator { | |
private let characters = Array("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
private let separator = "-" | |
public func generateIdentifier() -> String { | |
let numCharacters = UInt32(characters.count) | |
func randomCharacter() -> Character { | |
let index = Int(arc4random_uniform(numCharacters)) | |
return characters[index] |
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
#include <assert.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include "wren.h" | |
void logFromWren(WrenVM *vm) { | |
//double x = wrenGetArgumentDouble(vm, 0); // returns 0 in this setting | |
const char *message = wrenGetArgumentString(vm, 1); | |
printf("logFromWren: %s\n", message); | |
} |
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
#include "WProgram.h" | |
void UpdateDMD(); | |
void Bounce(); | |
void SetAllDots(byte value); | |
void SetDot(byte col, byte row, byte value); | |
void FrameToSerial(); | |
#define pinDisplayEnable 3 // DMD pin 1 | |
#define pinRowData 4 // One pin 3 | |
#define pinRowClock 5 // DMD pin 5 | |
#define pinColLatch 6 // DMD pin 7 |
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
Index: Framework/BGHUDTableViewHeaderCell.m | |
=================================================================== | |
--- Framework/BGHUDTableViewHeaderCell.m | |
+++ Framework/BGHUDTableViewHeaderCell.m | |
@@ -73,7 +73,7 @@ | |
} | |
- (void)_drawThemeContents:(NSRect)frame highlighted:(BOOL)flag inView:(id)view { | |
- | |
+ |
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
// Testing thread safety of rand() and random(); for more see: | |
// http://adampreble.net/blog/2012/09/mtrandom-an-objective-c-random-number-generator/ | |
// Created by Adam Preble on 9/3/12 | |
// Copyright (c) 2012 Adam Preble. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#if 1 | |
#define test_srandom srandom |
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
// A macro I wrote a few years back to assist in checking OpenGL error codes. | |
// Add to a .h or at the top of your implementation file: | |
#define GLERR do {\ | |
GLuint glerr;\ | |
while((glerr = glGetError()) != GL_NO_ERROR)\ | |
fprintf(stderr, "%s:%d glGetError() = 0x%04x", __FILE__, __LINE__, glerr);\ | |
} while (0) | |
// Sprinkle in "GLERR;" after failure-prone OpenGL calls. |
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 | |
/// Call a throwing block synchronously. | |
func dispatch_sync(queue: dispatch_queue_t, block: () throws -> ()) throws { | |
var error: ErrorType? | |
dispatch_sync(queue) { | |
do { | |
try block() | |
} catch let caughtError { | |
error = caughtError |
OlderNewer