Skip to content

Instantly share code, notes, and snippets.

View arbales's full-sized avatar

Austin Bales arbales

View GitHub Profile
@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
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 / 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
}
@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 / 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();
}
});
module Mycroft
module Action
class Base
def initialize(options)
@options = options
end
def self.create(options)
self.new(options).save
source "life://127.0.0.1"
gem "knowledge"
gem "happiness"
gem "longevity", "~>85.0", :require => "age"
gem "health"
gem "responsibility", "0.5.1a"
gem "wisdom"
gem "fun"
backend default {
.host = "localhost";
.port = "8000";
}
sub vcl_recv {
if (req.http.x-forwarded-for) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
@arbales
arbales / StorageManager.js
Created November 8, 2010 19:11
Aids in interacting with the HTML5 localStorage API. Moved to a proper repo and fixed.
// ## StorageManager
// Aids in interacting with the HTML5 localStorage API.
StorageManager = {
// Returns the data associated with a key or `false` of no data exists.
get: function(key){
var data = localStorage.getItem(key);
if (data === "" || data === null){
return false;
} else {
function urlify(text) {
var urlRegex = /(https?:\/\/[^\s]+)/g;
return text.replace(urlRegex, function(url) {
return '<a href="' + url + '">' + url + '</a>';
})
// or alternatively
// return text.replace(urlRegex, '<a href="$1">$1</a>')
}