Use Snowpack to extract and build JavaScript Modules and run in the browser.
- Download and unzip this gist
npm installnpm run snowpack# optional, should run by default duringnpm installnpm run serve
Use Snowpack to extract and build JavaScript Modules and run in the browser.
npm installnpm run snowpack # optional, should run by default during npm installnpm run serve| var Sqlite = require('sqlite3').verbose(); | |
| function SqliteCache( config ) { | |
| config = config || {}; | |
| this.db = new Sqlite.Database( config.db || void(0)); // will create an in-memory store if path is undefined. | |
| this.bucket = config.bucket || ''; | |
| this.duration = config.duration || 1000 * 60 * 5;//defaults to 5 minutes | |
| //initialize table | |
| this.db.run("CREATE TABLE IF NOT EXISTS cache (key TEXT PRIMARY KEY ASC, expires INTEGER, result TEXT)"); |
| /** | |
| TODO: these come back from restli requests... should we do anything w/ them? | |
| X-LinkedIn-Type: com.linkedin.restli.common.ActionResponse | |
| X-LinkedIn-Sub-Type: com.linkedin.janus.rest.api.JsonContentModel | |
| */ | |
| var keys = { | |
| '0': 'string', | |
| '1': 'int', |
| var Util = require('util'), | |
| Ee = require('events').EventEmitter, | |
| Fs = require('fs'), | |
| Spawn = require('child_process').exec, | |
| Crypto = require('crypto'); | |
| //this probably won't work well on other systems. also, this technique seems pretty fragile | |
| function isRunning(pid, callback) { | |
| Spawn('ps -hp ' + pid +' -o command', function(err, stdout) { | |
| var isSuccess = !err && stdout.toString().indexOf('ssh') > -1; |
| /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
| /* */ | |
| /* Simple node js module to get distance between two coordinates. */ | |
| /* */ | |
| /* Code transformed from Chris Veness example code - please refer to his website for licensing */ | |
| /* questions. */ | |
| /* */ | |
| /* */ | |
| /* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2011 */ | |
| /* - www.movable-type.co.uk/scripts/latlong.html */ |
| var fs=require('fs'), | |
| //rawTemplate=fs.readFileSync('/dev/stdin').toString(), | |
| spawn = require('child_process').spawn, | |
| java=spawn( | |
| 'java' | |
| ,['-jar','build/SoyToJsSrcCompiler.jar','--mattHack','--shouldProvideRequireSoyNamespaces','--codeStyle','concat'] | |
| ,{ | |
| cwd:"/Users/mpowell/Downloads/closure-templates-src/" | |
| //,customFds:[process.stdin,process.stdout,process.stderr] | |
| } |
| will update this later |
| function ssh() { | |
| #save all args (makes it easier to pass to ssh later) | |
| local all_args=$* | |
| #save path to ssh exec in current $PATH | |
| local ssh_path=$(which ssh) | |
| # host is second to last arg. see ssh -h |