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
# https://github.com/gazay/gon | |
gem 'gon' |
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
onerror = (err, file, line) -> | |
logger """ # console.log, alert, whatever | |
The following error occured: #{err} | |
In file: #{file} | |
At line: #{line} | |
""" |
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
Instagram 3.2.0 (iPhone5,2; iPhone OS 6.0.1; en_US) AppleWebKit/420+ | |
# 420, bro |
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
- classes can be no longer than 100 lines | |
- methods can be no longer than 5 lines | |
- methods cannot accept more than 4 parameters (no gigantic hashes) | |
- controllers cannot instantiate more than 1 object | |
- views cannot know about more than 1 instance variable | |
- views should only send messages to that variable (no Demeter violations) | |
- rules are meant to be broken if by breaking them you produce better code |
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(cap reg name) appends to register | |
append to macro stored in a with qAo | |
paste from unnamed ""p | |
execute code in unnamed register with @" | |
_ reg is blackhole - use to avoid clobbering current unnamed register |
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 HOURLY_RATE = 9999.99; // lulz | |
var inputs = [].slice.call(document.querySelectorAll('.price')); | |
inputs.forEach(function (price) { | |
if (price.children[0]) { | |
price.children[0].value = HOURLY_RATE; | |
} | |
}); |
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 self.method_missing(method, *args) | |
number_dictionary = { | |
first: 1, | |
second: 2, | |
third: 3, | |
fourth: 4, | |
fifth: 5, | |
sixth: 6, | |
seventh: 7, | |
eigth: 8, |
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 EasyLoader | |
constructor: (@DOT = '.', @TIMEOUT_LENGTH = 400, @MAX_NUMBER_OF_DOTS = 3) -> | |
@loading_message_timeout = true | |
render: -> | |
style_hash = | |
'left': '0' | |
'padding': '12px' | |
'position': 'absolute' | |
'text-align': 'center' |
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
window.log = (function () { | |
if (window.console && window.console.log) { | |
return function (message) { | |
console.log(message); | |
} | |
} else { | |
return function (message) { | |
alert(message); | |
} | |
} |
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 show | |
locals item: Item.find(params[:id]) | |
end | |
def locals(hash) | |
render locals: hash | |
end |
OlderNewer