Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@TonnyXu
TonnyXu / gcdSemaphor.md
Created August 7, 2012 06:23
Using GCD to let a thread/queue wait, an alternative way for `sleep(n)`

Before GCD

Almost the only option for us is sleep(n) (if you are familiar with SIGNAL, you can also use it). We are familiar with it, so let's pass it.

After GCD

There is resource called semaphore, use it can make your code more robust and more efficient.

 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.google.com"]];
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 5, 2024 13:30
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@jodell
jodell / nah_xcode_uncrustify.rb
Created February 20, 2012 04:34 — forked from mnem/nah_xcode_uncrustify.rb
Script file to be run as an Xcode 4 behaviour which uncrustifies the project source using reasonable Objective-C formatting defaults. Alternatively, you can run it and pass a path to uncrustify.
#!/usr/bin/env ruby
###########################################################################
# Script to be called as an Xcode 4 behaviour which will attempt to
# uncrustify all source files in the open project.
#
# (c) Copyright 2012 David Wagner.
#
# Complain/commend: http://noiseandheat.com/
#
#*************************************************************************#