Skip to content

Instantly share code, notes, and snippets.

View timshadel's full-sized avatar

Tim Shadel timshadel

View GitHub Profile
{
"photos": {
"href": "/photos",
"count": 154,
"collection": [
{
"href": "...",
"type": "image/jpeg",
"name": "beach.jpg"
}
@timshadel
timshadel / EmptyPodForWatchExtension.h
Last active August 29, 2015 14:18
Empty Pod For Watch Extension
/**
* If your watch extension doesn't need any of it's own exclusive pods,
* it won't have its header search path set to see any of the dependencies
* of embedded frameworks it relies on. This fixes that without duplication.
*/
@interface EmptyPodForWatchExtension
@end
@timshadel
timshadel / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@timshadel
timshadel / search_svn_log.rb
Created January 23, 2009 22:57
SVN log filter: Search the last 1000 lines of `svn log` for anything that references me, except those commits that used the `svnmerge` tool.
@record = []
def record_match?
record_string = @record.join(" ")
record_string =~ /shadel/i && record_string !~ /svnmerge/
end
def print_record
puts @record.join
end
@timshadel
timshadel / .bashrc
Created January 28, 2009 22:37 — forked from tekkub/.bashrc
Use git-symbolic-ref instead of git-branch for showing current branch on the commandline
parse_git_branch() {
git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3- | sed -e 's/\(.*\)/ (\1)/'
}
PS1="\w\$(parse_git_branch) $ "
@timshadel
timshadel / .bashrc
Created January 28, 2009 22:40 — forked from tekkub/.bashrc
Bold your current git branch on the command line (tested on Mac OS X)
TERM=xterm-color
# \[ starts a sequence of non-printable chars
# \] ends that sequence
# \e[1m turns text that follows Bold
# \e[m turns text that follows Normal
#
# \[\e[1m\] tells the shell not to count the non-printable bold command in it's wrapping calculations
# \[\e[m\] tells the shell not to count the non-printable normal command in it's wrapping calculations
#
# Unlike HTML <b></b> elements; this is more like <b>...<normal> It's important that the shell counts
@timshadel
timshadel / count.rb
Created February 16, 2009 15:50
Counts the number of files in each subdirectory of the given directory and then outputs the count in a Tufte-esque style histogram
# Counts the number of files in each subdirectory of the given directory
# and then outputs the count in a Tufte-esque style histogram, where the
# number before the | is the 10's column, and each number after the |
# represents one data point with that value. This lets you see the
# spread to get a sense of the distribution. Each 10's value has two
# rows: one for values 0-4, one for 5-9
#
# 0|
# 0|99
# 1|0001233333333344444444444
@timshadel
timshadel / .gitconfig
Created April 2, 2009 20:43
Simple way to access github through a proxy server
[core]
gitproxy="/Users/name/bin/gitproxy" for github.com
require 'socket'
require 'openssl'
# port can be anything. here it's ldaps
socket = TCPSocket.new("some.secure.server.com", 636)
ssl_context = OpenSSL::SSL::SSLContext.new()
unless ssl_context.verify_mode
warn "warning: peer certificate won't be verified this session."
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
sslsocket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)
require 'restclient'
require 'pp'
require 'hpricot'
if ARGV.size == 0
puts "Usage: showheaders.rb <url> [headers]"
puts
puts " Headers are optional, but should come in as pairs of arguments."
puts " showheaders.rb <url> If-None-Match 4eb6dc"
exit 1