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
Handlebars.registerHelper ('truncate', function (str, len) { | |
if (str.length > len) { | |
var new_str = str.substr (0, len+1); | |
while (new_str.length) { | |
var ch = new_str.substr ( -1 ); | |
new_str = new_str.substr ( 0, -1 ); | |
if (ch == ' ') { | |
break; |
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
/** | |
* @author Rob W <gwnRob@gmail.com> | |
* @website http://stackoverflow.com/a/7513356/938089 | |
* @version 20120724 | |
* @description Executes function on a framed YouTube video (see website link) | |
* For a full list of possible functions, see: | |
* https://developers.google.com/youtube/js_api_reference | |
* @param String frame_id The id of (the div containing) the frame | |
* @param String func Desired function to call, eg. "playVideo" | |
* (Function) Function to call when the player is ready. |
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 kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
$(document).keydown(function(e) { | |
kkeys.push( e.keyCode ); | |
if ( kkeys.toString().indexOf( konami ) >= 0 ) { | |
$(document).unbind('keydown',arguments.callee); |
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
img { | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\' filterRes=\'800\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+ */ | |
filter: gray; /* IE6-9 */ | |
-webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ | |
-webkit-backface-visibility: hidden; /* Fix for transition flickering */ | |
-webkit-transition: all 0.5s ease; | |
-moz-transition: all 0.5s ease; | |
-ms-transition: all 0.5s ease; | |
-o-transition: all 0.5s ease; | |
transition: all 0.5s ease; |
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
function urlify(text){ | |
var urlRegex = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi; | |
return text.replace(urlRegex, function(url){ | |
return '<a href="' + url + '">' + url + '</a>'; | |
}); | |
}; |
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
<script type="text/javascript"> | |
function youtube_parser(url){ | |
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; | |
var match = url.match(regExp); | |
if (match&&match[7].length==11){ | |
return match[7]; | |
}else{ | |
alert("Url incorrecta"); | |
} | |
} |
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
// FROM http://orderedlist.com/blog/articles/live-search-with-quicksilver-style-for-jquery | |
(function($) { | |
var self = null; | |
$.fn.liveUpdate = function(list) { | |
return this.each(function() { | |
new $.liveUpdate(this, 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
$.preloadImages = function(){ | |
for(var i = 0; i < arguments.length; i++){ | |
$("<img />").attr("src", arguments[i]); | |
} | |
}; |
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
(function($){ | |
})(jQuery); |
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
// Comparison Helper for handlebars.js | |
// Pass in two values that you want and specify what the operator should be | |
// e.g. {{#compare val1 val2 operator="=="}}{{/compare}} | |
Handlebars.registerHelper('compare', function(lvalue, rvalue, options) { | |
if (arguments.length < 3) | |
throw new Error("Handlerbars Helper 'compare' needs 2 parameters"); | |
operator = options.hash.operator || "=="; |
NewerOlder