Used here:
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
/* jshint esversion:6, node: true */ | |
// https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens | |
// http://www.sitepoint.com/using-json-web-tokens-node-js/ | |
'use strict'; | |
let express = require('express'); | |
let app = express(); | |
let bodyParser = require('body-parser'); |
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
body-parser - 837KB, 188 items, 10 immediate deps, 18 total deps | |
cookie-parser - 29KB, 19 items, 2 immediate deps, 2 total deps | |
express - 935KB, 302 items, 25 immediate deps, 39 total deps | |
express-jwt - 1.5MB, 721 items, 4 immediate deps, 31 total deps | |
express-winston - 701KB, 214 items, 3 immediate deps, 13 total deps | |
helmet - 543KB, 252 items, 11 immediate deps, 35 total deps | |
jsonwebtoken - 521KB, 254 items, 3 immediate deps, 26 total deps | |
useragent - 245KB, 35 items, 1 immediate dep, 1 total dep | |
winston - 471KB, 135 items, 7 immediate deps, 7 total deps | |
winston-cloudwatch - 15.6MB, 2866 items, 3 immediate deps, 97 total deps (!) |
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
// https://www.reddit.com/r/javascript/comments/4eb61r/interview_exercise_feedback/ | |
function isBalanced(str) { | |
var dict = { | |
'{': '}', | |
'(': ')', | |
'[': ']' | |
}; | |
var stack = []; | |
for (var i = 0; i < str.length; i++) { |
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
/* jshint esversion:6, node: true */ | |
let http = require('http'); | |
let querystring = require('querystring'); | |
let moment = require('moment-timezone'); | |
const PORT = 8081; | |
let server = http.createServer(function (req, res) { | |
let qs = req.url.split('?'); |
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
REBOL [] | |
generate-id: func [/length len /local chars out] [ | |
chars: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_" | |
out: copy "" | |
if none? len [ len: 8 ] | |
loop len [ | |
random/seed form now/precise | |
ind: random/secure length? chars | |
append out pick chars ind |
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
let code = "console.log('testing')"; | |
// encode | |
let a = [...code] | |
.map(x => x.charCodeAt()) | |
.map(x => x.toString(2)) | |
.join('2'); | |
// decode | |
let chars = a.split('2').map(x => parseInt(x, 2)); |
I hereby claim:
- I am rebolyte on github.
- I am rebolyte (https://keybase.io/rebolyte) on keybase.
- I have a public key whose fingerprint is 539C 63BE 4607 65A6 BCEC 1BD4 C7D2 2C36 3781 BFA3
To claim this, I am signing this object:
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
it('can call a callback that is passed', function () { | |
let callback = jasmine.createSpy('callback function'); | |
let putItem = jasmine.createSpy().and.callFake((params, cb) => { | |
expect(params.id).not.toBeUndefined(); | |
cb('done'); | |
}); | |
putItem({ id: 1 }, callback); |
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
#!/bin/bash | |
mode="" | |
filename="" | |
# http://stackoverflow.com/a/7069755 | |
while test $# -gt 0; do | |
case "$1" in | |
-h|--help) |