Skip to content

Instantly share code, notes, and snippets.

View trek's full-sized avatar
🏳️‍🌈

Trek Glowacki trek

🏳️‍🌈
View GitHub Profile
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
@trek
trek / color.js
Last active August 29, 2015 14:16
var Color = {};
Color.fromRGB = function (color) {
var ary = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return [ary[1]/255, ary[2]/255, ary[3]/255];
};
Color.fromHex = function (color) {
if (color.length == 7) {
return [parseInt('0x' + color.substring(1, 3)) / 255,
# Sets up expectation so that times aren't off by moments
Time.should_receive(:now).and_return(@current_time)
@current_time.should_receive(:to_i).and_return(1214619134)
class Me
def who
self
end
def holdit
self.method(:who)
end
end
var Foo = function Request(options) { this.initialize.apply(this, arguments) };
OPTIONS = new Hash({'format': false, 'async': true})
@xhr[:onreadystatechange] = self.on_state_change
this.$xhr.$onreadystatechange = this.onStateChange();
return $nil
if ($T(type.match((/DOMMouseScroll|mousewheel/)))) { var wheel = ($T(nativeEvent.wheelDelta) ? (nativeEvent.wheelDelta / (120)) : ($T(_a=nativeEvent.detail)?_a:(0).-() / (3))); };
// a = nativeEvent.detail.-()
class BalanceError(Exception):
value = "Sorry you only have $%6.2f in your account"
class BankAccount:
def __init__(self, initialAmount):
self.balance = initialAmount
print "Account created with balance %5.2f" % self.balance
def deposit(self, amount):
self.balance = self.balance + amount