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]; |
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
package week3 | |
object intsets { | |
util.Properties.versionString //> res0: String = version 2.10.2 | |
// 1..100, shuffled | |
val largeSet = util.Random.shuffle((1 to 100).toList).foldLeft(Empty: IntSet)(_.incl(_)) | |
Empty.union(Empty) | |
Empty.union(largeSet) | |
largeSet.union(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
package week3 | |
import util.Random; | |
object intsets { | |
util.Properties.versionString | |
// Return the (approx) number of seconds elapsed after calling the given block | |
def time[R](block: => R): Double = { | |
val t0 = System.nanoTime() |
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}'\'')' | |
##### |
OlderNewer