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 fillBitsFromRight(n) { // http://jsperf.com/fill-bits-bitwise-vs-alternatives | |
return ~(-1 << n); // ~(~0 << n) | |
} |
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
/* | |
Copyright 2013 Leonardo Dutra Constancio. | |
https://gist.github.com/LeoDutra/ - leodutra.br@gmail.com | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to |
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 toArrayBuffer(buffer) { | |
const ab = new ArrayBuffer(buffer.length); | |
const view = new Uint8Array(ab); | |
for (var i = 0, l = buffer.length; i < l; i++) { | |
view[i] = buffer[i]; | |
} | |
return ab; | |
} | |
function toBuffer(ab/*:ArrayBuffer*/) { |
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
/* source: http://css-tricks.com/snippets/css/clear-fix/ */ | |
.float-group:after { | |
visibility: hidden; | |
display: block; | |
content: ""; | |
clear: both; | |
height: 0; | |
} | |
* html .float-group { zoom: 1; } /* IE6 */ |
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 toCharEntity(str, useHexa) { | |
if (str !== undefined && str !== null) { | |
str = '' + str; | |
var codeCache; | |
var res = ''; | |
for(var i = 0, l = str.length; i < l ;) { | |
res += '&#'; | |
codeCache = str.charCodeAt(i++); | |
res += useHexa ? 'x' + codeCache.toString('16') : codeCache; | |
res += ';'; |
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 repeat(str, times) { | |
var n = times | 0; | |
var res = ''; | |
var buffer = str; | |
for (;;) { | |
if (n & 1) res += buffer; | |
if (n >>= 1) buffer += buffer; | |
else break; | |
} | |
return res; |
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://css-tricks.com/the-css-overflow-property/ */ | |
.scroll-x { | |
overflow-x: auto; | |
-ms-overflow-x: auto; | |
} | |
.scroll-y { | |
overflow-y: auto; | |
-ms-overflow-y: auto; | |
} |
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
UF Municipio | |
GO Abadia de Goiás | |
MG Abadia dos Dourados | |
GO Abadiânia | |
MG Abaeté (Minas Gerais)|Abaeté | |
PA Abaetetuba | |
CE Abaiara | |
BA Abaíra | |
BA Abaré |
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
The worst way is to send to Recycle Bin: you still need to delete them. Next worst is shift+delete with Windows Explorer: it wastes loads of time checking the contents before starting deleting anything. | |
Next best is to use rmdir /s/q foldername from the command line. del /f/s/q foldername is good too, but it leaves behind the directory structure. | |
The best I've found is a two line batch file with a first pass to delete files and outputs to nul to avoid the overhead of writing to screen for every singe file. A second pass then cleans up the remaining directory structure: | |
del /f/s/q foldername > nul | |
rmdir /s/q foldername | |
This is nearly three times faster than a single rmdir, based on time tests with a Windows XP encrypted disk, deleting ~30GB/1,000,000 files/15,000 folders: rmdir takes ~2.5 hours, del+rmdir takes ~53 minutes. More info at Super User. |
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
CREATE TABLE IF NOT EXISTS `pais` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nome` varchar(60) DEFAULT NULL, | |
`sigla` varchar(10) DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; | |
INSERT INTO `pais` (`id`, `nome`, `sigla`) VALUES (1, 'Brasil', 'BR'); | |