Skip to content

Instantly share code, notes, and snippets.

View nateklaiber's full-sized avatar

Nate Klaiber nateklaiber

View GitHub Profile
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@daz
daz / gist:5392816
Last active December 16, 2015 06:39
Getting distinct years in Rails and Postgresql
# start_time is a #datetime column, Postgres stores as a timestamp, we need to use date_part to extract 'year'
Event.select("date_part('year', start_time)").uniq
# Spits out
# SELECT DISTINCT date_part('year', start_time) FROM "events"
@jsok
jsok / README
Created October 4, 2012 04:36
iOS 6 SMS database dumping
Looking into how to retrieve SMS archives from iOS 6.
Useful resources:
http://lasc.livejournal.com/284909.html
To explain the datetime mangling:
"The timestamps are not traditional timestamps of the number of seconds from 1/1/1970, but are instead based on the number of seconds from 1/1/2001 (so, there is a 31 year offset). So, we have to add the number of seconds in 31 years (978264705) to the timestamp to change it to a traditional timestamp giving the number of seconds from 1/1/1970."
Query below will pull a history of all message to and from the PHONE NUMBER specified.
@shunchu
shunchu / convert-seconds-into-hh-mm-ss-in-ruby.rb
Created July 25, 2012 07:58
Convert seconds into HH:MM:SS in Ruby
t = 236 # seconds
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# Reference
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
@hilios
hilios / gist:1284170
Created October 13, 2011 12:57
Nginx YSlow performance boost w/ Gzip + Far future expires Header
server {
# output compression saves bandwidth
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# make sure gzip does not lose large gzipped js or css files
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
require 'rufus/scheduler'
scheduler = File.join(File.dirname(__FILE__), 'scheduler.rb')
options = {
:app_name => 'scheduler',
:ARGV => ARGV,