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
update: -> | |
if @converting | |
this.convert() if ((ticks - @started_converting) > CONVERT_TIME) | |
else if (ticks - @moved_at) > SPEED[@type] | |
this.move() |
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
config.ru | |
------------------------ | |
require './hello' | |
run Sinatra::Application | |
Gemfile | |
------------------------ | |
source "http://rubygems.org" | |
gem "rack", "~>1.1" |
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
(function($) { | |
//This represents a "Placeholder" | |
var Placeholder = function($element, options){ | |
//set up our placeholder | |
this.options = options || {}; | |
this.$input = $element; | |
this.$placeholderText = this.input.attr('placeholder'); | |
this.$placeholder = $('<div class="placeholder">') | |
.css({ |
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 s(l): | |
if len(l)<2:return l | |
return [l.pop(l.index(min(l)))] + s(l) |
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
# Place all the behaviors and hooks related to the matching controller here. | |
# All this logic will automatically be available in application.js. | |
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | |
BPMS = (60/104) * 1000 | |
HEART_POS = 200 | |
FUDGE = 50 | |
class Game | |
constructor: (@song, @pane) -> |
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
PS1="\[\033[0;37m\][\@] \[\033[0;32m\]\u@\h\[\033[0;36m\]:\w\$\[\033[0m\] " | |
alias ls='ls -FG' | |
alias l='ls -laF' | |
export LSCOLORS="cxfxcxdxbxegedabagacad" |
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
function fib(n){ | |
if(n < 2) return 1; | |
if(fib[n]) return fib[n]; | |
return fib[n] = fib(n-1) + fib(n-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
int maxlen = max(a.length, b.length, c.length); | |
for(int i = 0; i < maxlen; i++){ | |
int ai = max(a.length - i, 0); | |
int bi = max(b.length - i, 0); | |
int ci = max(c.length - i, 0); | |
//dostuff | |
} |
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
$("#somelink").on("click", function(){ | |
$("#somediv").show(); | |
$("#anotherdiv").hide(): | |
$("#athirddiv").hide(); | |
}); |
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 price | |
return @price if @price | |
@price = Money.new(self.cents || 0, self.some_relationship.currency || Money.default_currency) | |
end | |
def price=(new_price) | |
@price = new_price.to_money | |
self.cents = @price.cents | |
self.some_relationship.currency = @price.currency_as_string | |
end |