Skip to content

Instantly share code, notes, and snippets.

View wookiehangover's full-sized avatar
💭
just setting up my gthb...

Sam Breed wookiehangover

💭
just setting up my gthb...
View GitHub Profile
// duck punch Array.indexOf into IE browsers
if(!Array.indexOf){
Array.prototype.indexOf = function(obj){
for(var i=0; i<this.length; i++){
if(this[i]==obj){
return i;
}
}
return -1;
}
@wookiehangover
wookiehangover / qlgallery autoplay
Created January 13, 2011 18:38
starts and 8 second autoPlay
function autoPlay(){
$('a.next').trigger('click');
setTimeout(autoPlay, 8e3);
}
setTimeout(autoPlay, 8e3);
@wookiehangover
wookiehangover / fitBest.js
Created February 1, 2011 02:17
javascript truncate w/ respect for tags
function fitBest(str, n){
var r = /\W+\w*(?=$)/m,
s = str.slice(0, n - 1)+"\n",
t = /<\/?[^>]+>/g,
c = /\/+/g,
p = /<\/?[^>]+(?=$)/m,
e = "...",
new_str = s.slice(0, s.search(r)),
tags = new_str.match(t),
open_tags = [],
@wookiehangover
wookiehangover / webkit-custom-scrollbar.css
Created February 4, 2011 21:02
Super-dooper hot webkit only scroll bar. This will fallback to use the default styles in FF & IE
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Custom Webkit scroll bar, super fucking dope
http://beautifulpixels.com/goodies/create-custom-webkit-scrollbar/ */
body { position:absolute; top:0px; left:0; bottom:0; right:10px; overflow-y:scroll; overflow-x:hidden;}
html {
overflow-y: auto;
background-color: transparent;
}
::-webkit-scrollbar {
@wookiehangover
wookiehangover / movies.netflix.com.js
Created February 25, 2011 07:38
dotjs script that adds a sort button to your netflix instant queue
/*
*
* ___ ___ ___ ___ ___ ___
* /\__\ /\ \ /\ \ /\ \ /\__\ ___ |\__\
* /::| | /::\ \ \:\ \ /::\ \ /:/ / /\ \ |:| |
* /:|:| | /:/\:\ \ \:\ \ /:/\:\ \ /:/ / \:\ \ |:| |
* /:/|:| |__ /::\~\:\ \ /::\ \ /::\~\:\ \ /:/ / /::\__\ |:|__|__
* /:/ |:| /\__\ /:/\:\ \:\__\ /:/\:\__\ /:/\:\ \:\__\ /:/__/ __/:/\/__/ ____/::::\__\
* \/__|:|/:/ / \:\~\:\ \/__/ /:/ \/__/ \/__\:\ \/__/ \:\ \ /\/:/ / \::::/~~/~
* |:/:/ / \:\ \:\__\ /:/ / \:\__\ \:\ \ \::/__/ ~~|:|~~|
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* source: source at km_theme
* source: rubygems repository http://rubygems.org/
* rails (= 3.0.3)
* sqlite3-ruby
* spree (~> 0.40.1)
* active_merchant (~> 1.5.2)
@wookiehangover
wookiehangover / localStorage Cache Wrapper.js
Created March 19, 2011 00:16
a simple wrapper for localStorage
function cache(key, value, persist, expires){
if( typeof key == "undefined" ) return;
var data, is_json,
cache_value = localStorage.getItem(key);
// Return value if just the key is passed
if( typeof value == "undefined" ) {
// Detect if the string from localStorage tastes like JSON or an Array
is_json = /^\{|\[.+\}|\]$/.test(cache_value);
@wookiehangover
wookiehangover / index.html
Created April 10, 2011 06:28
jquery mobile basic index
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
@wookiehangover
wookiehangover / index.html
Created April 10, 2011 18:18
adding some list elements to a basic jQuery Mobile template
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
@wookiehangover
wookiehangover / buttons.html
Created April 14, 2011 22:34
here are some different style options of jQuery Mobile buttons
<a href="#" data-role="button">Click Me</a>
<a href="#" data-role="button" data-icon="delete">Delete Something</a>
<h3>Inline Buttons</h3>
<div data-inline="true">
<a href="#" data-role="button" data-inline="true">Rad</a>
<a href="#" data-role="button" data-theme="b" data-inline="true">Dope</a>
</div>