This file contains hidden or 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
/** | |
* Repete a string informada no parâmetro str | |
* a quantidade de vezes informada no parâmetro num | |
* @param {string} str - a String a ser repetida | |
* @param {int} num - o número de vezes a repetir | |
* @returns {string} | |
*/ | |
function repeat(str, num) { | |
var arr = [], i = 0; | |
while (i < num) { arr[i++] = str; } |
This file contains hidden or 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
/** | |
* Repete a string informada no parâmetro str | |
* a quantidade de vezes informada no parâmetro num | |
* @param {string} str - a String a ser repetida | |
* @param {int} num - o número de vezes a repetir | |
* @returns {string} | |
*/ | |
function repeat(str, num) { | |
var arr = [], i = 0; | |
while (i < num) { arr[i++] = str; } |
This file contains hidden or 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 timer = function(name) { | |
var start = new Date(); | |
return { | |
stop: function() { | |
var end = new Date(); | |
var time = end.getTime() - start.getTime(); | |
console.log('Timer:', name, 'finished in', time, 'ms'); | |
} | |
} | |
}; |
This file contains hidden or 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 x let (escopo de bloco/variável local) | |
// let ECMAS6 | |
var x = 45; | |
if(true) { | |
let x = 10; | |
console.log(x); // 10 | |
} | |
console.log(x); // 45 | |
var x = 45; |
This file contains hidden or 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 docReady(fn) { | |
if (window.addEventListener) { | |
window.addEventListener('load', fn, false); | |
} else if (window.attachEvent) { | |
window.attachEvent('onload', fn); | |
} | |
} |
This file contains hidden or 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
.loop (0) {} | |
.loop (@index) when (@index > 0) { | |
.classname-@{index} { | |
top: @index * 1px; | |
} | |
.loop (@index - 1); | |
} | |
#example { | |
.loop(5); |
This file contains hidden or 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
/* Define two variables as the loop limits */ | |
@from : 0; | |
@to : 10; | |
/* Create a Parametric mixin and add a guard operation */ | |
.loop(@index) when(@index =< @to) { | |
/* As the mixin is called CSS is outputted */ | |
div:nth-child(@{index}) { | |
top: unit(@index * 100, px); |
This file contains hidden or 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
<?php | |
// <img src="data:image/png;base64,...> data:image/jpeg;charset=utf-8;base64, | |
// http://danielmclaren.com/node/90 | |
$image = 'http://images.itracki.com/2011/06/favicon.png'; | |
// Read image path, convert to base64 encoding | |
$imageData = base64_encode(file_get_contents($image)); | |
// Format the image SRC: data:{mime};base64,{data}; |
This file contains hidden or 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
Contém: | |
$("input[id*='DiscountType']") | |
Não contém: | |
$("input[id!='DiscountType']") | |
Começa com: | |
$("input[id^='DiscountType']") | |
Termina com: |
This file contains hidden or 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
// Conectar ao bitbucket na porta 443 (caso a 22 esteja bloqueada) | |
# ~/.ssh/config | |
Host bitbucket.org | |
IdentityFile ~/.ssh/id_rsa | |
# o host é: | |
ssh://[email protected]:443/ | |
# configurar agent no keepass | |
https://github.com/mendhak/keepass-and-keeagent-setup |