This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function(){ | |
jQuery('.lcp_catlist li a') | |
//Set up the imgs for the green overlay | |
.find('img').css({ | |
position:'relative', | |
zIndex:'1', | |
height: '120px', | |
width: '120px' | |
}) | |
//Back to the <a>s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Makes Vimeo videos on Tumblr larger than the max of 500px that Tumblr forces | |
* Change the 650 to whatever you want, but do NOT add px or % | |
* The height, by default, is set to auto which will calculate the 16:9 video size. | |
* You can set the height to a static number as well if you want. | |
* If you have any questions feel free to ask me: @oscargodson | oscargodson.com | |
*/ | |
(function(){ | |
var iframes = document.body.getElementsByTagName('iframe') | |
, newVimeoWidth = 650 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = "" + | |
"First line goes here" + | |
"Second line goes here" + | |
"and now the third" + | |
"and hell, let's throw in this line" + | |
"while we're at it" + | |
""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parseTemplate = function(s,j){ | |
for(x in j){ var r = new RegExp('{{'+x+'}}','g'); s = s.replace(r,j[x]); } | |
return s; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NOTE: don't use semicolon inside a ternary, use a comma like so: | |
x == 1 //If x == 1 | |
? alert(x) //Alert 1 | |
:( //Else... | |
alert('Error'), //alert an error | |
x = 1, //Change x to 1 | |
alert('All Fixed!') //Alert the user again, say it's fixed | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
list = list.sort(function(){ | |
return Math.random() - 0.5; | |
}); | |
alert(list); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parseUrl = function(url){ | |
var q = {} | |
, r = new RegExp("([^?=&]+)(=([^&]*))?", "g"); | |
url.replace(r,function($0, $1, $2, $3){ q[$1] = $3; }); | |
return q; | |
} | |
/** | |
* var example = parseUrl('http://google.com?foo=bar&hello=world'); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bacon = new Bacon('hickory'); | |
bacon.cook(function(cookedBacon){ | |
cookedBacon.nom(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* fakejax is a simple way to prototype AJAX. It will give you a random response time of 0-3 seconds | |
* and it will also give you a 1 in 10 chance of returning an error | |
* @param {String} dummyCall This is the fake path like "/api/users" | |
* @param {Object} returnThis This is what you want it to return if it's successful like {data:'hi'} | |
* @param {Function} callback This is the callback to your AJAX after it completes | |
* @example http://jsbin.com/oguyoz/5 | |
*/ | |
var fakejax = function(dummyCall,returnThis,callback){ | |
dummyCall = dummyCall || ''; |