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 generateBase64ZipFromString(filenameInZip, fileContents, password, tmpDir) { | |
importPackage(Packages.net.lingala.zip4j); | |
var uuid = UUIDGenerator.getUUID(); | |
var filenameZip = tmpDir + uuid + ".zip"; | |
var filenameCsv = tmpDir + uuid + ".csv"; | |
var zipFile = new Packages.net.lingala.zip4j.core.ZipFile( filenameZip ); |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Fluid Layout</title> | |
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> | |
<style rel="stylesheet" type="text/css"> | |
body { background-color:black; margin:0px; padding:0px; } | |
.pageBox { position:absolute; top:20px; left:20px; right:20px; bottom:20px; min-width:200px} | |
.headerBox { position:absolute; width:100%; height:50px; background-color:#333; } | |
.contentBox { position:absolute; width:100%; top:52px; bottom:32px; background-color:blue; } |
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
Windows Registry Editor Version 5.00 | |
;-------------------------- | |
; Save as .reg and execute | |
;-------------------------- | |
; This will make it appear when you right click ON a folder | |
; The "Icon" line can be removed if you don't want the icon to appear | |
[HKEY_CLASSES_ROOT\Directory\shell\sublime] |
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
nasmw.exe -f win32 -Xvc -o "$(IntDir)\$(InputName).obj" $(InputDir)\$(InputName).asm | |
"$(IntDir)\$(InputName).obj" | |
extern "C" void __cdecl mmx_memcpy(void *d,void *s,int bytes); |
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 replaceNode(&$srcNode, &$dstNode,&$xmlDoc) | |
{ | |
$newNode = $xmlDoc->importNode($srcNode, true); | |
$dstNode->parentNode->replaceChild($newNode,$dstNode); | |
} | |
function importNode(&$newNode, &$refNode,&$xmlDoc) | |
{ | |
if ($newNode->childNodes) | |
foreach ($newNode->childNodes as $child) |
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
importPackage(Packages.net.lingala.zip4j); | |
var zipFile = new Packages.net.lingala.zip4j.core.ZipFile("d:\\test.zip"); | |
var filesToAdd = new java.util.ArrayList(); | |
filesToAdd.add(new java.io.File("d:\\test.dcm")); | |
var parameters = new Packages.net.lingala.zip4j.model.ZipParameters(); | |
//parameters.setCompressionMethod(Packages.net.lingala.zip4j.util.Zip4jConstants.COMP_STORE); // set compression method to store compression | |
parameters.setEncryptFiles(true); |
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 listaNUHSAS=['AN1000038583','AN0326435212','AN0408397178','AN0404408155','AN0415331870','AN0415531870']; | |
function esNUHSAValido(nuhsa) | |
{ | |
var re = /AN\d{10}/gi; | |
if (!re.test(nuhsa)) | |
return false; | |
var b=parseInt(nuhsa.substr(2,8)); | |
var c=parseInt(nuhsa.substr(10,2)); |
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 obj = {a:1, 'b':'foo', c:[false,null, {d:{e:1.3e5}}]}; | |
var str = JSON.stringify(obj, undefined, 2); // indentation level = 2 | |
See the MDN Docs for further details (e.g. on the second argument); | |
If you need syntax highlighting, you might use some regex magic like so: | |
function syntaxHighlight(json) { | |
if (typeof json != 'string') { | |
json = JSON.stringify(json, undefined, 2); | |
} |
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 createRingBuffer = function(length){ | |
var start = 0, buffer = []; | |
for (var i=0; i<length; i++) | |
buffer[i] = -10; | |
return { | |
get : function(key){return buffer[(start+key) % length];}, | |
push : function(item){ |
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() { | |
try { | |
var a = new Uint8Array(1); | |
return; //no need | |
} catch(e) { } | |
function subarray(start, end) { | |
return this.slice(start, end); | |
} |