Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
#!/bin/bash | |
f=$(pwd) | |
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork" | |
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x" | |
sips --resampleWidth 57 "${f}/${1}" --out "${f}/Icon.png" | |
sips --resampleWidth 114 "${f}/${1}" --out "${f}/Icon@2x.png" | |
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-Small.png" | |
sips --resampleWidth 58 "${f}/${1}" --out "${f}/Icon-Small@2x.png" | |
sips --resampleWidth 50 "${f}/${1}" --out "${f}/Icon-Small-50.png" |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
// to build: | |
// lessc <filename> > site.css | |
// lessc <filename> > site.min.css --compress | |
// the swatch | |
@color1: #55626b; | |
@color2: #6c9380; | |
@color3: #c1ca55; | |
@color4: #f07d6b; | |
@color5: #ad5472; |
#!/usr/bin/env ruby | |
require 'csv' | |
require 'json' | |
if ARGV.size != 2 | |
puts 'Usage: csv_to_json input_file.csv output_file.json' | |
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects' | |
exit(1) | |
end |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
Handlebars.registerHelper('if_task_active', function(options) { | |
var state = this.model.state_id; | |
if (state == 300) { | |
return options.fn(this); | |
} | |
return options.inverse(this); | |
}); |
var partial = function(func) { | |
return Function.prototype.bind.apply(func, arguments); | |
}; | |
function add() { | |
var x = 0; | |
[].forEach.call(arguments, function(el) { | |
x += el; |
var user = { | |
validateCredentials: function (username, password) { | |
return ( | |
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
: false | |
); |
class Example.Views.Table extends Backbone.View | |
template: JST['example/table'] | |
initialize: -> | |
_.bindAll @, 'addOne', 'addAll' | |
@collection.on 'add', @addOne | |
render: -> | |
@$el.html @template() |
#!/usr/bin/env ruby | |
# Requires imagesnap from https://github.com/alexwilliamsca/imagesnap (brew install imagesnap) | |
# To assemble the video use http://www.dayofthenewdan.com/projects/tlassemble | |
file="~/.gitshots/#{Time.now.to_i}.jpg" | |
puts "Taking capture into #{file}!" | |
system "imagesnap -q -w 3 #{file}" | |
exit 0 |