Skip to content

Instantly share code, notes, and snippets.

View jplew's full-sized avatar

JP Lew jplew

View GitHub Profile
@jplew
jplew / index.js
Last active May 17, 2019 22:47
Run an op from a gist
#!/usr/bin/env node
const boxen = require("boxen")
const logo = `
██████╗ ████████╗ ██████╗  █████╗ ██╗
██╔════╝ ╚══██╔══╝ ██╔═══██╗ ██╔══██╗ ██║
██║   ██║  ██║ ██║ ███████║ ██║
██║   ██║  ██║ ██║ ██╔══██║ ██║
[2018-10-11 12:39:17.023] [exthost] [info] extension host started
[2018-10-11 12:39:17.074] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"activationEvent":"*"}
[2018-10-11 12:39:17.074] [exthost] [info] ExtensionService#loadCommonJSModule /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/debug-auto-launch/dist/extension
[2018-10-11 12:39:17.088] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"activationEvent":"*"}
[2018-10-11 12:39:17.088] [exthost] [info] ExtensionService#loadCommonJSModule /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/emmet/dist/extension
[2018-10-11 12:39:17.149] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"activationEvent":"*"}
[2018-10-11 12:39:17.149] [exthost] [info] ExtensionService#loadCommonJSModule /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main
[2018-10-11 12:39:17.270] [exth
@jplew
jplew / fakeDataHelpers.js
Created August 23, 2018 22:52
helper functions to create fake dates
/**
* @author: JP Lew (jp@hackcapital.com)
* @date: Monday, 23rd July 2018 5:14:39 pm
* @lastModifiedBy: JP Lew (jp@hackcapital.com)
* @lastModifiedTime: Thursday, 23rd August 2018 1:03:37 pm
* project: Share Results
* @copyright (c) 2018 Hack Capital
*/
const randomNumber = (min = 0, max = 10) => Math.floor(Math.random() * max) + min;
@jplew
jplew / index.js
Created July 29, 2018 06:15
Routes exporter (routes/index.js)
const initWordbankRoutes = require('./wordRoutes.js')
const initOxfordRoutes = require('./oxfordRoutes.js')
module.exports = function(app, db) {
initWordbankRoutes(app, db)
initOxfordRoutes(app)
return app
}
@jplew
jplew / server.js
Last active July 29, 2018 06:37
Entry point to NodeJS Oxford API
const yargs = require('yargs')
const query = yargs.argv
const env = getEnv(query.env)
function getEnv(env) {
if (env === 'dev') {
return ''
} else if (env) {
return '.env.' + env
} else {
@jplew
jplew / oxfordRoutes.js
Created July 29, 2018 05:28
Oxford API routes in NodeJS/Express
const axios = require('axios')
const oxfordDefine = 'https://od-api.oxforddictionaries.com/api/v1/entries/en'
const oxfordInflect =
'https://od-api.oxforddictionaries.com/api/v1/inflections/en'
const config = {
headers: {
Accept: 'application/json',
app_id: process.env.OXFORD_ID,

Keybase proof

I hereby claim:

  • I am jplew on github.
  • I am jplew (https://keybase.io/jplew) on keybase.
  • I have a public key ASCYtTBpcRGcBz5SrlMo376ZIW0Fzu2hm0ujkEAZ_mBGAgo

To claim this, I am signing this object:

@jplew
jplew / map.component.ts
Created April 19, 2018 15:45
ArcGIS Inline example working
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@jplew
jplew / map.component.ts
Created April 19, 2018 15:16
esri namespace problem
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@jplew
jplew / gist:c0ebade552034ea1630ec05067bd18e4
Last active April 19, 2018 12:41
Typescript rewrite of ArcGIS Sample Code
/*
Copyright 2018 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and