Skip to content

Instantly share code, notes, and snippets.

@bryfox
bryfox / gif_sprite.sh
Created January 8, 2011 22:05
Use montage to turn an animated GIF into a single-frame sprite
montage -tile x1 -geometry '1x1+0+0<' -alpha On -background "rgba(0,0,0,0.0)" -quality 100 frames.gif sprite.gif
@lukeredpath
lukeredpath / ExampleClass.m
Created June 30, 2011 22:18
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
@bryfox
bryfox / test_varnish.pl
Created July 22, 2011 01:06
Quick & dirty Varnish test script using Test::Varnish
#!/opt/local/bin/perl
use Test::More;
use Test::Varnish;
$url = 'FIXME';
$num_runs = 10;
plan tests => $num_runs;
my $tv = Test::Varnish->new({verbose => 1});
@nuxlli
nuxlli / sublime_text_2_useful_shortcuts.md
Created September 9, 2011 18:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@bryfox
bryfox / percent-mobile-helper.rb
Created January 11, 2012 18:53
Sinatra port of Percent Mobile's rails helper for analytics
require 'sinatra/base'
require 'cgi'
module Sinatra
# http://code.percentmobile.com/snippet/ruby_on_rails/percent_mobile/lib/percent_mobile_helper.rb
module PercentMobileHelper
PERCENT_MOBILE_COOKIE_PATH="/"
PERCENT_MOBILE_VISIT_DURATION=60*60
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@yamaya
yamaya / xcode-clang-vers
Last active November 10, 2024 04:44
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@BenedictC
BenedictC / gist:4246759
Created December 9, 2012 20:03
A marco for creating enums with values which can be logged (inspired by http://rentzsch.tumblr.com/post/37512716957/enum-nsstring and long train journey).
#define EMKStringableEnum(ENUM_NAME, ENUM_VALUES...) \
\
typedef enum { \
ENUM_VALUES \
} ENUM_NAME; \
\
\
\
static NSString * ENUM_NAME##ToString(int enumValue) { \
static NSString *enumDescription = @"" #ENUM_VALUES; \

You're about to start a library or open-source thing that you want to be available to any iOS project. This is a handy guide for how to get set up.

#Setup

  1. start a new Xcode project with "Empty Application"
  2. project settings: verify name, devices (probably want Universal), Core Data (probably not), ARC (probably)
  3. choose location, don't add to any workspace or project.

Ok, project exists. What now? Let's rip out all that boilerplate Xcode so graciously gave us.

@GLMeece
GLMeece / latency_numbers.md
Last active May 22, 2024 15:57
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -