Skip to content

Instantly share code, notes, and snippets.

View steveluscher's full-sized avatar

Steven Luscher steveluscher

View GitHub Profile
# http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/b29b9ac9b43a5281
seconds_to_wait_for_lock = 5
begin
raise "Timed out while trying to acquire lock" unless connection.select_value("SELECT GET_LOCK('order_lock_for_product_#{@product.id}', #{seconds_to_wait_for_lock})") == "1"
# ... validate order availability ...
# ... create orders ...
rescue
# ... oh oh ...
# ... a stuck lock? ...
/*
Eric Meyer's Reset Reloaded – SASS version
http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
/path/to/rails_apps/*/log/*.log {
daily
missingok
rotate 30
compress
delaycompress
sharedscripts
postrotate
find /path/to/rails_apps/* -name tmp -maxdepth 1 -type d -exec touch {}/restart.txt \;
endscript
@steveluscher
steveluscher / mojo_dojo_connector.js
Created August 11, 2011 16:56
A Mojo->Dojo connector; re-implement these methods in another library, and you can use Mojo 2.0 without Dojo.
/* Mojo-Dojo connector */
(function() {
if(typeof mojo == 'undefined') mojo = {};
mojo.addOnUnload = dojo.addOnUnload;
mojo.clone = dojo.clone;
mojo.config = dojo.config;
mojo.connect = dojo.connect;
mojo.declare = dojo.declare;
mojo.destroyElement = dojo._destroyElement;
@steveluscher
steveluscher / gist:1675040
Created January 25, 2012 06:15
Pronounceable password
/** Creates a pronounceable random password
* @param string $len, optional length (default 8)
* @retrun string the generated password
*/
function make_passwd($len=8)
{
$letter=array(
array("b","c","d","f","g","i","l","m","n","o","p","qu","r","s","t","v","z"),
array("a","e","i","o","u"));
$pass="";
@steveluscher
steveluscher / id3_midterm_support.js
Created January 25, 2012 06:19
Interface Development 3 Support File
var countriesVisited = new Array();
(function() {
var country_list = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Cape Verde","Cayman Islands","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica","Cote D Ivoire","Croatia","Cruise Ship","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana","Haiti"
<h3>This content lives on a remote server</h3>
<p>Hey! You did it! You fetched some remote content!</p>
@steveluscher
steveluscher / gist:1865168
Created February 19, 2012 18:54
Spontaneous disconnection of USB peripherals from a Mac (see https://discussions.apple.com/message/17638040)
Feb 19 10:42:02 Steven-Luschers-Computer kernel[0]: CoreStorageGroup::completeIORequest - error 0xe00002d9 detected for LVG "Untitled" (4429443B-1B86-420D-B309-C5556661A1CD), pv B10FEEFC-C4C2-452A-9A62-7640C9862D83, near LV byte offset = 161472323584.
Feb 19 10:42:02 Steven-Luschers-Computer kernel[0]: disk4: device/channel is not attached.
Feb 19 10:42:02 Steven-Luschers-Computer kernel[0]: CoreStorageGroup::completeIORequest - error 0xe00002d9 detected for LVG "Untitled" (4429443B-1B86-420D-B309-C5556661A1CD), pv B10FEEFC-C4C2-452A-9A62-7640C9862D83, near LV byte offset = 161473212416.
Feb 19 10:42:02 Steven-Luschers-Computer kernel[0]: disk4: device/channel is not attached.
Feb 19 10:42:02 Steven-Luschers-Computer kernel[0]: CoreStorageGroup::completeIORequest - error 0xe00002d9 detected for LVG "Untitled" (4429443B-1B86-420D-B309-C5556661A1CD), pv B10FEEFC-C4C2-452A-9A62-7640C9862D83, near LV byte offset = 161473298432.
Feb 19 10:42:02 Steven-Luschers-Computer kernel[0]: disk4: device/channel is not attac
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie10 lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie10 lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie10 lt-ie9" lang="en"> <![endif]-->
<!--[if IE 9]> <html class="no-js lt-ie10" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@steveluscher
steveluscher / IN-MEDIAS-RES_tonight-i-am-new_guitar-tab.txt
Created August 8, 2012 06:38
Tonight I Am New (IN MEDIAS RES) Guitar tab transcribed by Steven Luscher (http://lakefieldmusic.com)
Tonight I Am New
IN MEDIAS RES
Guitar Tab
Transcribed by Steven Luscher (http://lakefieldmusic.com)
VERSE A
e|--------------------------|--------------------------|--------------------------|--------------------------|
B|--------------------------|--------------------------|--------------------------|--------------------------|