Skip to content

Instantly share code, notes, and snippets.

View timshadel's full-sized avatar

Tim Shadel timshadel

View GitHub Profile
@timshadel
timshadel / .bak.yml
Created January 7, 2011 21:55
Back up old files to an archive directory. Configurable with multiple dirs. It'll zip up directories when archiving.
trash: ~/.Trash
default: w
dirs:
w: ~/work/myjob/archive
p: ~/Dropbox/Archive
o: /path/to/other/archive
@timshadel
timshadel / make_video.sh
Created February 11, 2011 18:50
Create a Gource visualization of the Rails codebase as it crosses into GitHub land...
# On a Mac
# brew install gource (http://code.google.com/p/gource/)
# brew install ffmpeg
# git clone https://github.com/rails/rails.git
# In the rails code directory, run this to see the same visualization
gource --hide bloom,files,filenames,dirnames --auto-skip-seconds 0.3 --seconds-per-day 0.003 --date-format "%B %Y" --start-position 0.2 --stop-position 0.45 --file-idle-time 10 --stop-at-end -1024x768
# Or do this to save it to a reusable video:
gource --hide bloom,files,filenames,dirnames --auto-skip-seconds 0.3 --seconds-per-day 0.003 --date-format "%B %Y" --start-position 0.2 --stop-position 0.45 --file-idle-time 10 --stop-at-end -1024x768 -o - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre slow -threads 0 rails-on-github.mp4
@timshadel
timshadel / alias-bundle-exec.bash
Created September 22, 2011 05:04
Ideas for eliminating 'bundle exec' when using rbenv
#!/usr/bin/env bash
#
# Put this in ~/.rbenv/rbenv.d/init/
# Based in part on http://twistedmind.com/bundle-exec-bash-shortcut
# For a completely different take, see https://github.com/carsomyr/rbenv-bundler
#
# Slower. More correct? Choosing faster one for now.
# echo bundled_bins=\(`rbenv exec ruby -rbundler/setup -e 'puts Bundler.rubygems.all_specs.map{|s| s.executables}.flatten.join(" ")'`\)
# Only aliases executable names of the global Ruby. Cheap way to `rbenv exec` in every version?
@timshadel
timshadel / src+head.json
Created November 13, 2012 18:37
Idea for using src + HTTP HEAD or GET with Accept headers for embedding items into Collection+JSON
{ "collection" :
{
"version" : "1.0",
"href" : "http://example.org/friends/",
"items" :
[
{
"href" : "...",
"data" :
@timshadel
timshadel / src-head.json
Created November 13, 2012 18:39
Idea for using src + HTTP HEAD or GET with Accept headers for embedding items into Collection+JSON
{ "collection" :
{
"version" : "1.0",
"href" : "http://example.org/friends/",
"items" :
[
{
"href" : "...",
"data" :
@timshadel
timshadel / add-friend.json
Created November 13, 2012 19:22
What makes it media?
{
"template": {
"prompt_src": "graph:|profile/facebook.com|propmts:friends:connect#confirm_required",
"input": {
"name": "gref",
"prompt_src": "graph:|profile/facebook.com|propmts:friends:connect#gref",
"required": true,
"type": "gref"
},
"input": {

Ask curl to connect to localhost, but send the Host header with a different value

$ curl -H "Host: fake.com" http://localhost:8585

curl will hang until you kill the server.

//
// UIImage+H568.h
//
// Created by Angel Garcia on 9/28/12.
// Copyright (c) 2012 angelolloqui.com. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (H568)
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
+ (NSString *)platform;
@timshadel
timshadel / app-password.js
Last active December 12, 2015 01:08 — forked from camshaft/app.js
/**
* Module dependencies
*/
var request = require("superagent"),
password = require("password"),
password.initialize(require("password-bearer"));
/**
* Make the request
*/