This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Place this in your executable path (e.g. "~/bin/git-export") | |
# and you should now be able to go: git export [path] | |
PWD=$(pwd) | |
# Exit on error (e.g., "Not a git repository") | |
set -e | |
TOP_LEVEL=$(git rev-parse --show-toplevel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use 'docker.io' if using the official packages on Ubuntu 14.04+ | |
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
drm() { docker rm ; } | |
dri() { docker rmi ; } | |
alias dkd="docker run -d -P" | |
alias dki="docker run -t -i -P" | |
alias docker_rmi_all='docker rmi $(docker images|tail -n +2|awk '\''{print $1":"$2}'\'')' | |
##### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Place this in your executable path (e.g. "~/bin/git-ignore") | |
# and you should now be able to go: git ignore [path/argspec] | |
# Exit on error (e.g., "Not a git repository") | |
`git rev-parse --show-toplevel`.chomp | |
exit(1) unless $?.success? | |
if ARGV.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
# Needs https://github.com/gitpython-developers/GitPython, pip install gitpython | |
from git import Repo | |
repo = Repo('.') | |
active_branch = repo.active_branch.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rexml/document' | |
IMAGES = 'images' | |
SOUNDS = 'sounds' | |
FONTS = 'data' | |
file = File.join('properties', 'resources.xml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def self.class_for_name(name) | |
klass = Module.const_get(name) | |
klass.is_a?(Class) ? klass : nil | |
rescue NameError | |
nil | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
BASE_MARGIN = ARGV[0] ? ARGV[0].to_f : 2.12766 # Twitter Bootstrap default | |
BASE_WIDTH = ARGV[1] ? ARGV[1].to_f : (100.0 - (BASE_MARGIN * 11))/12.0 | |
puts <<-ZZZ | |
.row-fluid { | |
& > [class*="span"] { | |
margin-left: #{BASE_MARGIN}%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -eq 0 ]; then | |
echo "Usage:" | |
echo " dir2dmg <path/to/directory>" | |
exit 1 | |
fi | |
PWD=`pwd` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -f ".env" ]; then | |
while read line; do | |
# ignore blank lines and lines starting with '#' (comments) | |
if [[ ! -z $line && ! $line == \#* ]]; then | |
export $line | |
fi | |
done < .env | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString* path = [[NSBundle mainBundle] pathForResource: @"collections" ofType: @"json"]; | |
NSError* e; | |
NSString* json = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&e]; | |
id data = [RKNSJSONSerialization objectFromData:[json dataUsingEncoding:NSUTF8StringEncoding] error:&e]; | |
NSMutableArray* collections = [[NSMutableArray alloc] initWithCapacity:[data count]]; | |
for (id record in data) { | |
Collection* collection = [Collection new]; | |
RKMappingOperation* op = [[RKMappingOperation alloc] initWithSourceObject:data destinationObject:collections mapping:[Collection mapping]]; | |
[op start]; |
OlderNewer