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.preload | |
* | |
* Preload images using the promise pattern. | |
* | |
* Usage: | |
* | |
* $.preload(img_uri, img_uri, ...).done(function(img, img, ...) { | |
* // Do stuff with the arguments | |
* }); |
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
#!/bin/bash | |
# limpa a pasta antiga | |
rm -rf ~/Sites/apache-tomcat-6.0.37/work/Catalina/localhost/ | |
FOLDER=$(pwd) | |
LocalHostFolder="~/Sites/apache-tomcat-6.0.37/conf/Catalina/localhost/" | |
ROOTFile=$LocalHostFolder"ROOT.xml" | |
XMLTemplate="<Context docBase=\"$FOLDER/web\" path=\"\"> | |
</Context>" |
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
window.ParsleyConfig = { | |
validators: { | |
cpf: { | |
fn : function ( val, req) { | |
val = $.trim(val); | |
val = val.replace('.',''); | |
val = val.replace('.',''); | |
cpf = val.replace('-',''); | |
while(cpf.length < 11) cpf = "0"+ cpf; |
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 src="//www.youtube.com/player_api"></script> | |
<script type="text/javascript"> | |
// attach our YT listener once the API is loaded | |
// | |
var $ = jQuery; | |
// listen for play/pause, other states such as rewind and end could also be added | |
// also report % played every second | |
function onPlayerStateChange(e) { | |
// e["data"] == YT.PlayerState.PLAYING && ; |
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 checkCPF( val ) { | |
val = $.trim(val); | |
val = val.replace('.',''); | |
val = val.replace('.',''); | |
cpf = val.replace('-',''); | |
while(cpf.length < 11) cpf = "0"+ cpf; | |
var expReg = /^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$/; | |
var a = []; | |
var b = new Number; |
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
Show hidden characters
{"keys": ["super+shift+h"], "command": "encode_html_entities"} |
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
@mixin placeholder() { | |
&::-webkit-input-placeholder { | |
@content; | |
} | |
&:-moz-placeholder { | |
@content; | |
} | |
&::-moz-placeholder { |
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 thePlayer = new YT.Player('yt-embed', { | |
height: '360', | |
width: '540', | |
videoId: 'bScJ8bbwMNM', | |
events: { | |
'onStateChange': function(e){ | |
switch (e.data) { | |
case YT.PlayerState.ENDED: | |
clearWatcherVideo(); | |
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
angular.module('myApp') | |
.directive('chosen',function(){ | |
'use strict'; | |
var linker = function(scope, element, attrs) { | |
var config = scope.$eval(attrs['chosen']), | |
list = attrs['chosenCollection']; | |
_.extend(config, {inherit_select_classes: true}); |
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
'use strict'; | |
// Add ECMA262-5 method binding if not supported natively | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind | |
if (!Function.prototype.bind) { | |
Function.prototype.bind = function (oThis) { | |
if (typeof this !== "function") { | |
// closest thing possible to the ECMAScript 5 internal IsCallable function | |
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); | |
} |