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 traverseObj (obj) { | |
if (typeof obj === "object") { | |
$.each(obj, function(index, value) { | |
console.log(index); | |
traverse(value); | |
}); | |
} else { | |
console.log(obj); | |
} | |
} |
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
#!/usr/bin/env node | |
var watchFile = require('./watcher'); | |
watchFiles(process.cwd(), function (file) { | |
console.log(file); | |
}); |
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 path = require('path'); | |
var fs = require('fs'); | |
function getJsFilesInPath (dir, ignoredPaths, files) { | |
'use strict'; | |
var join = path.join; | |
files = files || []; | |
fs.readdirSync(dir).filter(function (filePath) { |
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
/** | |
* Applies logic from [debounce](http://underscorejs.org/#debounce) | |
* to angularjs. | |
* ver mais em http://loopinfinito.com.br/2013/09/24/throttle-e-debounce-patterns-em-javascript/ | |
*/ | |
function Ctrl($scope) { | |
$scope.$watch('typing', debounce(function() { | |
$scope.typed = $scope.typing; | |
$scope.$apply(); |
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 hasDuplicates(array) { | |
var valuesSoFar = {}; | |
for (var i = 0; i < array.length; ++i) { | |
var value = array[i]; | |
if (Object.prototype.hasOwnProperty.call(valuesSoFar, value)) { | |
return true; | |
} | |
valuesSoFar[value] = true; | |
} | |
return false; |
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
/** | |
* Dado um numero, formata o mesmo de acordo com um divisor passado. | |
* @param {'number'} number numero a formatar | |
* @param {'string'} divider dos centavos | |
* @return {'string'} o numero formatado. | |
*/ | |
function formatNumber (number, cDivider) { | |
number = number.toFixed(2) + ''; | |
var x = number.split('.') | |
, x1 = x[0] |
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
#!/usr/bin/env node | |
var Lazy = require('lazy'); | |
var fs = require('fs'); | |
var poliglota = require('poliglota'); | |
var argv = require('minimist')(process.argv.slice(2)); | |
new Lazy(fs.createReadStream(argv.filename || 'port.txt')) | |
.lines | |
.forEach(function (line) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Iframe</title> | |
</head> | |
<body> | |
<button>Botão</button> | |
<script type="text/javascript"> |
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
{ | |
"ddds":[ | |
68, | |
82, | |
97, | |
92, | |
96, | |
75, | |
73, | |
74, |
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 isArray (obj) { | |
return toString.call(obj) === '[object Array]'; | |
} | |
function flatten (arr) { | |
var result = []; | |
for (var i in arr) { | |
if (isArray(arr[i])) { | |
flatten(arr[i]).forEach(function (elem) { |