1/3, 2/3 columns
<div class="row">
<div class="column width-2"></div>
<div class="column width-4"></div>
</div>
(function( $ ){ | |
$.fn.styleCheckbox = function() { | |
return this.each(function() { | |
var $custom, $label, toggleCheckbox, $input = $(this); | |
$custom = $('<a class="checkbox" href="#"></a>'); | |
toggleCheckbox = function() { |
d3.selection::attrs = (attrs) -> | |
for key, value of attrs | |
@attr(key, value) | |
return this | |
d3.selection::addClass = (name) -> | |
@classed(name, true) | |
return this |
# Sorts an array based on a property of each object within the array | |
# | |
# Examples: | |
# | |
# [Em.Object.create(a: 1), Em.Object.create(a: 5), Em.Object.create(a: 3)].sortProperty('a') | |
# > [{a: 1}, {a: 3}, {a: 5}] | |
# | |
# As a computed property: | |
# | |
# AC = Em.ArrayController.extend |
var pathToObject = function(path) { | |
var i, parent, part, parts, _len; | |
parent = window; | |
parts = path.split('.'); | |
for (i = 0, _len = parts.length; i < _len; i++) { | |
part = parts[i]; | |
parent = parent[part] || (parent[part] = {}); | |
} |
# Only the professor can fix it | |
fixit() { | |
clear; | |
echo -e '\x1B[30;45m'"\n\033[1m Bundle installing... \033[0m\n"; | |
bundle install; | |
echo -e '\x1B[30;45m'"\n\033[1m Migrating database... \033[0m\n"; | |
bundle exec rake db:migrate; |
hasPushState = !!(window.history && window.history.pushState) | |
window.FTW or= {} | |
class FTW.Router | |
constructor: (@routes) -> | |
if hasPushState | |
window.onpopstate = (e) => | |
@navigate(@getURI()) | |
# Inspired by http://stackoverflow.com/a/149099/1649199 | |
Number::formatMoney = (t=',', d='.', c='$') -> | |
n = this | |
s = if n < 0 then "-#{c}" else c | |
i = Math.abs(n).toFixed(2) | |
j = (if (j = i.length) > 3 then j % 3 else 0) | |
s += i.substr(0, j) + t if j | |
return s + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) |
require 'mechanize' | |
@agent = Mechanize.new | |
@agent.user_agent_alias = 'Mac Safari' | |
def sign_in(email, password) | |
page = @agent.get "https://99designs.com/login" | |
form = page.forms.first | |
form.field_with(name: 'email').value = email | |
form.field_with(name: 'password').value = password |
window.parseHash = function() { | |
var parsed = {}; | |
var pairs = window.location.hash.replace('#', '').split('&'); | |
pairs.forEach(function(pair) { | |
parsed[pair.split('=')[0]] = (parseInt(pair.split('=')[1], 10) || pair.split('=')[1]); | |
}); | |
return parsed; | |
}; |