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
var BaseObject = { | |
create: function create() { | |
var instance = Object.create(this); | |
instance._construct.apply(instance, arguments); | |
return instance; | |
}, | |
extend: function extend(properties, propertyDescriptors) { | |
propertyDescriptors = propertyDescriptors || {}; |
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
# A collection of useful distance calculation functions for the earth | |
from __future__ import division | |
from math import sin, cos, acos, asin, radians, degrees, sqrt | |
EARTH_RADIUS = 6371009 # meters | |
class Geolocation(object): | |
def __init__(self, latitude, longitude): | |
self.latitude = latitude # Restrict to be within -90 and 90 |
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
cd ~ | |
wget http://go.googlecode.com/files/go1.0.3.linux-amd64.tar.gz | |
tar -zxvf go1.0.3.linux-amd64.tar.gz | |
rm go1.0.3.linux-amd64.tar.gz | |
# binary distributions assume they will be installed at /usr/local/go | |
# Otherwise, you must set the GOROOT environment variable | |
sudo mv ~/go /usr/local | |
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc | |
mkdir -p ~/Workspace/go-workspace | |
mkdir -p $HOME/Workspace/go-workspace/src |
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
# OS X Homebrew (Package Manager) Setup | |
# Assumes: | |
# + GCC installed via XCode comamnd line tools (https://connect.apple.com) | |
# Install latest Homebrew release (0.9.4 as of July 6, 2013) | |
############################################################################### | |
# Homebrew placed under '/usr/local' so package installs don't require sudo. | |
# Individual brew packages (kegs) isolated in their own directory under | |
# '/usr/local/Cellar' |
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
var country_to_adjectival = { | |
"Afghanistan": "Afghan", | |
"Albania": "Albanian", | |
"Algeria": "Algerian", | |
"Angola": "Angolan", | |
"Antigua": "Antiguan", | |
"Barbuda": "Antiguan", | |
"Argentina": "Argentine", | |
"Armenia": "Armenian", | |
"Australia": "Australian", |
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
struct EchoArgs { | |
1: required string Message | |
} | |
struct EchoReply { | |
1: required string Echo | |
} | |
struct MultiplyArgs { |
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
// This file is automatically generated. Do not modify. | |
package echoer_thrift | |
type EchoArgs struct { | |
Message string `thrift:"1,required" json:"Message"` | |
} | |
type EchoReply struct { | |
Echo string `thrift:"1,required" json:"Echo"` |
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
def time[A](a: => A) = { | |
val now = System.nanoTime | |
val result = a | |
val micros = (System.nanoTime - now) / 1000 | |
println("%d microseconds".format(micros)) | |
result | |
} | |
def validIdByRegex(id: String): Boolean = { | |
val idPattern = """[0-9]+""".r |
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/sh | |
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}') | |
# Get Xcode CLI tools | |
# https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/index-3905972D-B609-49CE-8D06-51ADC78E07BC.dvtdownloadableindex | |
TOOLS=clitools.dmg | |
if [ ! -f "$TOOLS" ]; then | |
if [ "$OSX_VERS" -eq 7 ]; then | |
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg | |
elif [ "$OSX_VERS" -eq 8 ]; then |
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
# Gradle Files | |
.gradle | |
.m2 | |
.gradletasknamecache | |
# Build output directories and files | |
target/ | |
build/ | |
Version.java | |
logcat.txt |
OlderNewer