Skip to content

Instantly share code, notes, and snippets.

@leshill
leshill / resource_responder.rb
Created August 10, 2011 18:29
Responding to a JSON PUT with either a 200 and the updated JSON or 204 and no body
# The default Responder returns 200, {} for a PUT success.
# Not really happy with that. A 204, nil would be better.
# However, for most resources the result of a PUT is that something changes (updated_at).
# A 200 with the updated resource makes sense in that case.
#
# Not really happy with this first cut.
#
class ResourceResponder < ActionController::Responder
protected
@yhara
yhara / gist:1408888
Created November 30, 2011 12:22 — forked from avalanche123/gist:981817
GitHub Emoji (sort by category)
emotion :+1: :-1: :clap: :heart: :sparkles: :v: :zzz:
icon :new: :ok: :cool: :vs: :tm: :warning: :wheelchair: :zap: :art: :bomb: :bulb: :key: :lock: :memo: :mag:
item :book: :gift: :moneybag: :mega: :scissors: :hammer:
device :computer: :iphone: :calling: :email:
human :cop: :runner: :feet: :fist: :punch: :lipstick: :tophat:
food :beer: :cake: :smoking:
behicle :airplane: :bike: :bus: :ski: :taxi: :train:
animal :bear: :fish: :octocat:
nature :fire: :leaves: :star: :sunny:
@jappy
jappy / dos2unix.sh
Created March 10, 2012 18:03
Shell script to convert files with CRLF to LF (Mac/Linux)
#! /bin/sh
for x
do
echo "Converting $x"
tr -d '\015' < "$x" > "tmp.$x"
mv "tmp.$x" "$x"
done
@nicholashagen
nicholashagen / gist:2041175
Created March 15, 2012 01:56
Working with GitHub Forks

The following code is day-to-day operations when working with 3 forks: an open source project, a local fork of that project, and a company fork of that project. The power of Git is remote aliases that allow you to work with all 3 forks in parallel in the same code base and instantly compare, push, merge, etc.

Setup:

#> git clone [url of local fork: ie: username/project]
#> cd project
#> git remote add project [url of project: ie: project/project]
#> git remote add company [url of company fork: ie: company/project]
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@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:

@dabrahams
dabrahams / launchd.org
Last active July 7, 2024 12:10
Notes on Apple's under-documented launchd

Notes on Apple’s Under-Documented LaunchD

Start triggers fire regardless of other conditions

For example, StartOnMount=true will cause the job to start when anything is mounted even if other conditions, e.g. QueueDirectories, say the job should not run

Rhythm of repeating jobs

The StartInterval timer begins ticking at the moment the plist is loaded. If something like QueueDirectories is preventing the job from

@zenorocha
zenorocha / README.md
Last active May 28, 2024 08:23
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@ikai
ikai / build.gradle
Created June 10, 2013 23:54
TIL: to get Gradle to use external Maven dependencies, you need to declare repositories OUTSIDE 'buildscript'. If you don't, you get an error telling you Gradle can't resolve whatever external dependencies your project depend on.
buildscript {
repositories {
maven {
url 'http://repo1.maven.org/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}