Skip to content

Instantly share code, notes, and snippets.

View JoshOldenburg's full-sized avatar

Josh Oldenburg JoshOldenburg

View GitHub Profile
@JoshOldenburg
JoshOldenburg / JOAssertEqualsString.h
Created June 22, 2013 14:12
JOAssertEqualsString for SenTestKit is like STAssertEquals but for NSString's.
#define JOAssertEqualsString(a1, a2, description, ...) \
do { \
@try {\
if (![a1 isKindOfClass:[NSString class]] || ![a2 isKindOfClass:[NSString class]]) { \
[self failWithException:([NSException failureInFile:[NSString stringWithUTF8String:__FILE__] \
atLine:__LINE__ \
withDescription:@"%@", [@"Type mismatch -- " stringByAppendingString:STComposeString(description, ##__VA_ARGS__)]])]; \
} \
else { \
if (![a1 isEqualToString:a2]) { \
@rahuloak
rahuloak / server.js
Last active February 18, 2021 19:21
APNS mock server
/**
* Mock APNS server
*/
var net = require('net');
var HOST='127.0.0.1';
var PORT=7777;
// Need this option so the client doesn't close
// the connection on sending a FIN
@rahuloak
rahuloak / client.js
Last active February 18, 2021 19:20
APNS client
/**
* APNS test client
*/
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 7777;
var TOKEN_LENGTH = 64;
var NUM_PACKETS = 5;

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian - http://www.raspberrypi.org/downloads

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)

@mikeash
mikeash / test.m
Created July 9, 2012 21:15
Cocoa array slicing
// clang -framework Foundation -fobjc-arc -O3 test.m
#import <Foundation/Foundation.h>
@interface Slice : NSObject
@property NSInteger start;
@property NSInteger length;
@end
@implementation Slice
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 20, 2025 18:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@dave1010
dave1010 / htaccess
Created December 14, 2011 13:07
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config created by @dave1010
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>'
@mikeash
mikeash / gist:1355671
Created November 10, 2011 18:28
Multiple return
// clang -W -Wall -Wno-unused-parameter -framework Foundation -fobjc-arc test.m
#import <Foundation/Foundation.h>
#define IDARRAY(...) ((id[]){ __VA_ARGS__ })
#define IDCOUNT(...) (sizeof(IDARRAY(__VA_ARGS__)) / sizeof(id))
typedef id (^Tuple)(int);
@ibrow
ibrow / greetings.js
Created September 30, 2011 20:25
Experimenting with Middle End
/**
* Simple module for greeting people
**/
var Tidy = require('./tidy');
var Greetings = function() { }
Greetings.prototype.hello = function(who) {
who = Tidy.trim(who);
return this.hello(who);
}