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
/** | |
* @description Implementação de uma árvore binária de busca em JavaScript. | |
* @author Gabriel Dewes at 13 oct, 2016 | |
*/ | |
/** | |
* @constructor | |
*/ | |
function BinaryTree() { | |
/** |
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
// javac BinaryTree.java | |
// java BinaryTree | |
/** | |
* Created by Dewes on 13/09/2016. | |
*/ | |
public class BinaryTree { | |
// Nosso nó pai | |
private Node node; |
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
/** | |
* @description Simple hashing for JS objects | |
* @author Gabriel Dewes at 9 nov, 2016 | |
*/ | |
Object.prototype.hashify = function(obj, len) { | |
obj = obj || this; | |
len = len || 2; | |
var i, j, r=[]; | |
for (i=0; i<len; i++) { | |
r.push(i*268803292); |
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
/* Simple and fast generation of RFC4122 UUIDS. */ | |
(function(root, factory) { | |
'use strict'; | |
root.uuid = factory(); | |
})(window, function() { | |
var byteToHex = []; | |
for (var i=0; i<256; ++i) { | |
byteToHex[i] = (i + 0x100).toString(16).substr(1); |
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
/* It's of unspecified quality and not RFC4122. | |
* Very slow due to string replaces | |
*/ | |
var objectId = function () { | |
var timestamp = (Date.now() / 1000 | 0).toString(16); | |
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() { | |
return (Math.random() * 16 | 0).toString(16); | |
}).toLowerCase(); | |
}; |
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
[{ | |
"codigo_uf": 11, | |
"unidade_federacao": "Rondônia", | |
"sigla": "RO", | |
"area_km2": 237765.376, | |
"regiao": "Norte" | |
},{ | |
"codigo_uf": 12, | |
"unidade_federacao": "Acre", | |
"sigla": "AC", |
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
if ("undefined"===typeof jQuery) throw new Error("This function requires jQuery."); | |
function table(element, data) { | |
var g, a, b, r, i, e, l, | |
s = Date.now(); | |
g = $("<table class='table table-responsive table-hover'/>").appendTo(element); | |
a = $("<thead />").appendTo(g); | |
/* Generates the table thead */ | |
r = data[0]; // Some element of any position, use the element with more atributtes | |
for (i in r) { | |
if (r.hasOwnProperty(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
SELECT SUM(TABLE_ROWS) AS 'Total de Linhas', COUNT(*) AS 'Total de Tabelas' | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_SCHEMA = 'databaseName'; |
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() { | |
"use strict"; | |
Date.prototype.toYyyymmddhhmmss = function() { | |
var yyyy = this.getFullYear(), | |
mm = this.getMonth() < 9 ? ("0" + (this.getMonth() + 1)) : (this.getMonth() + 1), | |
dd = this.getDate() < 10 ? ("0" + this.getDate()) : this.getDate(), | |
hh = this.getHours() < 10 ? ("0" + this.getHours()) : this.getHours(), | |
min = this.getMinutes() < 10 ? ("0" + this.getMinutes()) : this.getMinutes(), | |
ss = this.getSeconds() < 10 ? ("0" + this.getSeconds()) : this.getSeconds(); | |
return "".concat(yyyy).concat("-") |
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
import java.io.*; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.nio.file.Files; | |
public class UploadResource { | |
// Uploading some binary file to http server |
OlderNewer