Skip to content

Instantly share code, notes, and snippets.

View arbales's full-sized avatar

Austin Bales arbales

View GitHub Profile
@arbales
arbales / gist:787221
Created January 20, 2011 01:11
pseudocode.
Event.addBehaviors({
".popup button.nevermind":function(){
this.up('.popup').hide();
return false;
},
"button.nevermind":function(){
window.location.back();
}
});
@arbales
arbales / app.coffee
Created March 7, 2011 20:47
CoffeeScript + LowPro = Delight
Event.addBehavior {
"form.register:submit": (event) ->
Event.stop event
@request {
onSuccess: =>
@update 'Splendid, we’ve got you down for an invite.'
}
}
@arbales
arbales / application.coffee
Created April 23, 2011 07:32
How sigils and a low-pro-y wrapper are used in Sailormoon, for ease and beauty.
Sailormoon.observe {
"a[sigil=login]:click": (event) ->
new Sailormoon.Views.LoginWindow(event)
false
"a[sigil=signup]:click": (event) ->
new Sailormoon.Views.Signup(event)
false
}
valid = _.reduce _.invoke(jQ(this).find('input'),'val'), (memo, num) ->
return num.length unless num.length > 5
memo is num
if typeof valid is 'number'
# too short
else if valid isnt yes
# not matching
@arbales
arbales / gist:1059152
Created July 1, 2011 18:44
netatalk configuration
./configure --enable-debian \
--with-acls \
--with-ssl-dir=/usr/include/openssl \
--enable-dropkludge \
--with-cracklib=/usr/share/cracklib/cracklib-small \
--with-libgcrypt-dir=/usr/lib
// As a param
$.ajax({
url: "/api/v1/kittens",
parameters: {name: "Sillycat", breed: "Tiger", token: "4815162342"},
success: function(){
// kitten created
}
});
@arbales
arbales / gist:1075626
Created July 11, 2011 09:54
Bluepill used at Halftoneapp.com
#
# Halftoneapp.com Sample Bluepill Configuration File
# Read more at: http://blog.halftoneapp.com
#
# Set paths
home_dir = "/home/railsapp"
rails_shared = "#{home_dir}/app/shared"
unicorn_path = "/path/to/unicorn_rails"
Endor.Utils.formatLinks = (content) ->
safeContent = Handlebars.Utils.escapeExpression(content)
safeContent = safeContent.replace LINK_DETECTION_REGEX, (url) ->
address = if /[a-z]+:\/\//.test url then url else "http://#{url}"
"<a href='#{address}' target='_blank'>#{url}</a>"
new Handlebars.SafeString(safeContent) # Mark our string as safe, since it is.
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://lotr/;
proxy_redirect off;
}
_.cycle = (arr) ->
->
arr.push arr.shift()
arr[0]