Skip to content

Instantly share code, notes, and snippets.

View garyv's full-sized avatar
🦕
hungry

Gary Von Schilling garyv

🦕
hungry
View GitHub Profile
@garyv
garyv / generate_state_select.js
Created July 11, 2012 19:23
generate_state_select.js
(function GENERATE_STATE_SELECT( $ ) {
var STATES ={'':'',AK:"Alaska",AZ:"Arizona",AR:"Arkansas",CA:"California",CO:"Colorado",CT:"Connecticut",DE:"Delaware",DC:"District of Columbia",FL:"Florida",GA:"Georgia",HI:"Hawaii",ID:"Idaho",IL:"Illinois",IN:"Indiana",IA:"Iowa",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",ME:"Maine",MD:"Maryland",MA:"Massachusetts",MI:"Michigan",MN:"Minnesota",MS:"Mississippi",MO:"Missouri",MT:"Montana",NE:"Nebraska",NV:"Nevada",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NY:"New York",NC:"North Carolina",ND:"North Dakota", OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VT:"Vermont",VA:"Virginia",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming"},
STATE_OPTION = '<option value="-key-">-name-</option>';
$( 'label' ).each( function() {
if ( this.innerHTML.match(/state/i) ) {
var stateInput = $( this ).parent().find( 'input' ),
@garyv
garyv / index.html
Created June 14, 2012 20:40
jQuery Auto Suggest
<!doctype html>
<html>
<head>
<title>
Auto Suggest jQuery plugin
</title>
<meta charset='utf-8' />
<meta name="description" content="SearchField example">
</meta>
@garyv
garyv / Gemfile
Created March 8, 2012 14:19
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@garyv
garyv / quicktime_audio.html
Created February 25, 2012 04:30
quicktime html5 audio
<!DOCTYPE html>
<html>
<head>
<title>
quicktime html5 audio
</title>
<meta charset='utf-8' />
<meta content='Play a quicktime file using an html5 audio element and javascript' name='description'>
<style>
.audio{ background: black; border: 4px solid black; box-shadow: 1px 2px 2px rgba(0,0,0,.2); width: 200px; height: 16px}
@garyv
garyv / hack.js
Created December 13, 2011 02:54
Simulate computer hacking by generating random numbers
var delay=200, count=0, cycles=9, total=999,
style='background:#000;color:#0f2;font:20px monospace; margin:0';
function hack(){
var s = '<p style=\''+style+'\'>';
for(var z=total; z-- > 0;) {
s += ' '+ Math.floor(z * Math.random() * cycles);
}
document.documentElement.innerHTML = s;
}
hack.loop = function() {
@garyv
garyv / loop_talk.js
Created December 6, 2011 02:11
Simple Loop
var delay=300, count=0, cycles=3;
function talk() {
console.log(true);
}
talk.loop = function() {
if (count < cycles) {
talk();
setTimeout(function() {
@garyv
garyv / do_a_barrel_roll.html
Created November 4, 2011 18:12
Do a barrel roll!
<!DOCTYPE html>
<html>
<head>
<title>
Do a barrel roll
</title>
<meta charset='utf-8' />
<meta name='description' content='' />
<meta name='viewport' content='width=device-width,initial-scale=1'>
<style>
@garyv
garyv / jquery.layoutscrollbarfix.js
Created October 3, 2011 14:16
layout scrollbar fix
// layout scrollbar fix for centered pages
// adapted from http://www.aaubry.net/fixing-jumping-content-when-scrollbars-appear.aspx
//
// How to stop a div with id "content" from moving when scroll bar appear
// $('#content').layoutScrollbarFix();
(function($){
var defaults = {interval: 100, repeat: 9000};
$.fn.layoutScrollbarFix = function(options) {
@garyv
garyv / DelayOpenApps.scpt
Created July 8, 2011 23:04
This is a script for Macs that will open a list of applications after a 1 minute delay. You can manage startup applications by going to  > System Preferences > Accounts > Unlock > Login Items > Plus button.
tell me
delay 1 * 60
activate
do shell script "ruby /Applications/startup.rb"
tell application "DelayOpenApps"
quit
end tell
end tell