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
const DEV = true; | |
function contract(conditions) { | |
if (DEV) { | |
return function(fn) { | |
return function() { | |
if (!conditions.pre.apply(null, arguments)) { | |
throw 'precondition failed on ' + fn.name | |
} |
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/awk -f | |
# | |
# csv format: | |
# firstname, lastname, tel | |
# | |
# ./csv2vcf.awk [filename.csv] > out.vcf | |
BEGIN { | |
FS="," | |
OFS="" | |
} |
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
"use strict" | |
var DesignPatterns = {}; | |
DesignPatterns.Utils = (function() { | |
function BadMethodCallException(message) { | |
this.message = message; | |
this.name = "BadMethodCallException"; | |
} |
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
/* | |
* parsecsv.js | |
* | |
* by: JP 2019 | |
* | |
* example: | |
* res = []; | |
* if (err = parsecsv('1,2,3\n4,5,6', res)) | |
* console.error(err); | |
* // res <-- [["1","2","3"],["4","5","6"]] |
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
/* | |
* CSV parser | |
* | |
* See RFC 4180 for CSV format specification. | |
* | |
* License MIT | |
* JP2019 | |
*/ | |
/** |
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
/* | |
* Y-Combinator | |
*/ | |
const Y = fn => | |
( m => (...args) => fn(m(m))(...args)) | |
( m => (...args) => fn(m(m))(...args)); | |
/* | |
* Creates function that resolves if given value belongs |
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
const throttle = fn => timeout => id => (...e) => | |
!id && (id = setTimeout(() => (id = null) || fn(...e), timeout || 100)) | |
const Y = fn => (m => x => fn(m(m))(x))(m => x => fn(m(m))(x)) |
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
"use strict" | |
var LEXICAL_GRAMMAR = { | |
"SingleLineComment": "Comment", | |
"MultiLineComment": "Comment", | |
"/*": { | |
"MultilineCommentChars": { | |
"*/": "MultiLineComment" | |
}, | |
"*/": "MultiLineComment" |
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
"use strict" | |
var Lexer = (function() { | |
var Context = (function() { | |
var SPECIAL_CHARS = { | |
"=": "OP", | |
"-": "OP", | |
"+": "OP", |
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/awk -f | |
# transforms txt into gpx format | |
BEGIN { | |
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<gpx creator=\"jardacardapetarda\" version=\"1.1\" xmlns=\"http://www.topografix.com/GPX/1/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n <trk>\n <name></name>\n <trkseg>" | |
} | |
/^[0-9]/ { | |
print "<trkpt lat=\"" $1 "\" lon=\"" $2 "\"></trkpt>" | |
} |
NewerOlder