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("debug", function(optionalValue) { | |
console.log("Current Context"); | |
console.log("===================="); | |
console.log(this); | |
if (optionalValue) { | |
console.log("Value"); | |
console.log("===================="); | |
console.log(optionalValue); | |
} |
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
{% plugin rawtext desktop_url %} | |
<script type="text/javascript"> | |
top.location.href="{{ desktop_url }}"; | |
</script> |
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 temporarySwap(array) | |
{ | |
var left = null; | |
var right = null; | |
var length = array.length; | |
for (left = 0, right = length - 1; left < right; left += 1, right -= 1) | |
{ | |
var temporary = array[left]; | |
array[left] = array[right]; | |
array[right] = temporary; |
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
{% raw %} | |
<script type="text/x-handlebars-template" id="gallery-template"> | |
{{#each cards}} | |
<div class="entry" data-index="{{itemIndex}}"> | |
{{{image}}} | |
<div class="share-btns"> | |
<div class="fbshare"><a href="#">Share</a></div> | |
<div class="tweet-btn"><a href="#">Tweet</a></div> | |
{{{shareActions}}} | |
</div> |
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 || "=="; |
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
$.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
// 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
<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"); | |
} | |
} |