Skip to content

Instantly share code, notes, and snippets.

package {
public function camelcase(str:String):String {
return capitalize( str.replace(/_([\w])/gi, function(...args):String {
return args[1].toUpperCase();
}) );
}
}
package {
public function capitalize(text:String):String {
return text.substr(0, 1).toUpperCase() + text.substr(1);
}
}
package {
public function findFirst(collection:Array, handler:Function):* {
var result:*;
collection.every(function(item:Object, index:int, items:Array):Boolean {
if(handler(item, index, items)) {
result = item;
return false;
}
return true;
});
package {
public function underscore(camelCased:String):String {
return camelCased.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
}
}
@lukebayes
lukebayes / remove_svn.sh
Created April 17, 2009 17:59
Remove all .svn folders forward of the current location
#!/bin/bash
find . -name .svn | xargs rm -rf $1
@lukebayes
lukebayes / remove_ds_store.sh
Created April 17, 2009 18:00
Remove os x .DS_Store files from this folder forward
#!/bin/bash
find . -name .DS_Store | xargs rm $1
require 'autotest/redgreen'
require 'autotest/menu'
module Autotest::Growl
def self.growl title, msg, image=nil, pri=0
path = Dir.pwd
# TODO: Change to your home path:
path.gsub!('/Users/lbayes/', '')
title += " in [#{path}]"
msg += " at #{Time.now.strftime('%I:%M %p')}"
omniture acct file is http://www.adobe.com/startpage/om_acct_nm.txt
Warning: Ignoring 'secure' attribute in policy file from http://adobe.omniture.112.2O7.net/crossdomain.xml. The 'secure' attribute is only permitted in HTTPS and socket policy files. See http://www.adobe.com/go/strict_policy_files for details.
Warning: Domain adobe.omniture.112.2O7.net does not specify a meta-policy. Applying default meta-policy 'all'. This configuration is deprecated. See http://www.adobe.com/go/strict_policy_files to fix this problem.
##################################
# MIT LICENSE
# Copyright (C) 2012 Luke Bayes
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@lukebayes
lukebayes / ERBResolver
Created October 21, 2009 16:55
A Rake Task that makes it stupid-easy to render ERB templates to disk
##################################
# MIT LICENSE
# Copyright (C) 2012 Luke Bayes
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: