Skip to content

Instantly share code, notes, and snippets.

Sam Breed wookiehangover

Block or report user

Report or block wookiehangover

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View IE Array.indexOf
// 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 Jan 13, 2011
starts and 8 second autoPlay
View qlgallery autoplay
function autoPlay(){
$('a.next').trigger('click');
setTimeout(autoPlay, 8e3);
}
setTimeout(autoPlay, 8e3);
@wookiehangover
wookiehangover / fitBest.js
Created Feb 1, 2011
javascript truncate w/ respect for tags
View fitBest.js
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 Feb 4, 2011
Super-dooper hot webkit only scroll bar. This will fallback to use the default styles in FF & IE
View webkit-custom-scrollbar.css
@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 Feb 25, 2011
dotjs script that adds a sort button to your netflix instant queue
View movies.netflix.com.js
/*
*
* ___ ___ ___ ___ ___ ___
* /\__\ /\ \ /\ \ /\ \ /\__\ ___ |\__\
* /::| | /::\ \ \:\ \ /::\ \ /:/ / /\ \ |:| |
* /:|:| | /:/\:\ \ \:\ \ /:/\:\ \ /:/ / \:\ \ |:| |
* /:/|:| |__ /::\~\:\ \ /::\ \ /::\~\:\ \ /:/ / /::\__\ |:|__|__
* /:/ |:| /\__\ /:/\:\ \:\__\ /:/\:\__\ /:/\:\ \:\__\ /:/__/ __/:/\/__/ ____/::::\__\
* \/__|:|/:/ / \:\~\:\ \/__/ /:/ \/__/ \/__\:\ \/__/ \:\ \ /\/:/ / \::::/~~/~
* |:/:/ / \:\ \:\__\ /:/ / \:\__\ \:\ \ \::/__/ ~~|:|~~|
View bundler error
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 Mar 19, 2011
a simple wrapper for localStorage
View localStorage Cache Wrapper.js
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 Apr 10, 2011
jquery mobile basic index
View index.html
<!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 Apr 10, 2011
adding some list elements to a basic jQuery Mobile template
View index.html
<!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 Apr 14, 2011
here are some different style options of jQuery Mobile buttons
View buttons.html
<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>
You can’t perform that action at this time.