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 inputOnlyLetters () { | |
var re_letters= /^[ ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZabcçdefghijklmnñopqrstuvwxyzàáãÃÀÁéèÈÉíìÍÌïÏóòõÕÓÒúùÚÙüÜ]+$/gi; | |
var re_not_letters= /[^ ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZabcçdefghijklmnñopqrstuvwxyzàáãÃÀÁéèÈÉíìÍÌïÏóòõÕÓÒúùÚÙüÜ]/gi; | |
$('.not-number').on('keyup', function() { | |
var input = this; | |
// user needs some time to write chars that need two strokes, like ç => ' + c | |
window.setTimeout(function(){ |
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
<snippet> | |
<content><![CDATA[ | |
console.log('${1:this} = ', ${1:snippet}); | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>clog</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.js</scope> | |
</snippet> |
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
<snippet> | |
<content><![CDATA[ | |
console.log(${1:this}); | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>log</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> |
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
// http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript | |
function stringWidth(s, className) { | |
var c = className || "", | |
o = $('<div class="' + c + '">' + s + '</div>') | |
.css({'position': 'absolute', 'float': 'left', 'white-space': 'nowrap', 'visibility': 'hidden'}) | |
.appendTo($('body')), | |
w = o.width(); | |
o.remove(); |
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 getURLParameter = function (name) { | |
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[undefined,""])[1].replace(/\+/g, '%20'))||null; | |
}; |
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
// http://stackoverflow.com/questions/7193425/how-do-you-animate-fb-canvas-scrollto | |
function scrollTo(y){ | |
FB.Canvas.getPageInfo(function(pageInfo){ | |
$({y: pageInfo.scrollTop}).animate( | |
{y: y}, | |
{duration: 1000, step: function(offset){ | |
FB.Canvas.scrollTo(0, offset); | |
} | |
}); |
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() { | |
if (jQuery.browser.msie) | |
$('img[src$=".png"]').each(function() { // must have quotes around .png | |
this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+this.src+",sizingMethod='scale')"; | |
}); | |
}); |
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
//http://stackoverflow.com/questions/7388001/javascript-regex-to-validate-date | |
//http://jsfiddle.net/mplungjan/Mqh8D/ | |
var isDate = function (str) { | |
var parms = str.split(/[\.\-\/]/); | |
var yyyy = parseInt(parms[2],10); | |
var mm = parseInt(parms[1],10); | |
var dd = parseInt(parms[0],10); | |
var date = new Date(yyyy,mm-1,dd,0,0,0,0); | |
return mm === (date.getMonth()+1) && dd === date.getDate() && yyyy === date.getFullYear(); | |
} |
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
//http://tryhandlebarsjs.com/ | |
//{{#list_fl people}}{{firstName}} {{lastName}}{{/list_fl}} | |
{ | |
people : [ | |
{ firstName: "Yehuda", lastName: "Katz" }, | |
{ firstName: "Carl", lastName: "Lerche" }, | |
{ firstName: "Alan", lastName: "Johnson" } | |
] |
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 matched, browser; | |
// Use of jQuery.browser is frowned upon. | |
// More details: http://api.jquery.com/jQuery.browser | |
// jQuery.uaMatch maintained for back-compat | |
jQuery.uaMatch = function( ua ) { | |
ua = ua.toLowerCase(); | |
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || | |
/(webkit)[ \/]([\w.]+)/.exec( ua ) || |