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 api = foo | |
api.foo = 1 | |
api.bar = 2 | |
export default api | |
Object.assign(foo, someThings) | |
export default foo | |
array.forEach(item => { | |
bar[item.key] = item.value |
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
const EventEmitter = require('events') | |
class ActivityStore extends EventEmitter { | |
constructor() { | |
this.state = 'stopped' // Whether you need this or not...? | |
} | |
start() { | |
this.state = 'started' | |
this.emit('started', this.state) | |
} |
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> | |
<html lang="en"> | |
<!-- Example HTML file for AWS Proxy Resource tutorial at: https://aws.amazon.com/blogs/compute/authorizing-access-through-a-proxy-resource-to-amazon-api-gateway-and-aws-lambda-using-amazon-cognito-user-pools/ --> | |
<!-- Fill out your UserPoolId, ClientId and apiGatewayEndpoint in JS further below --> | |
<!-- Then serve locally with a static file server, such as `python -m SimpleHTTPServer` and open http://localhost:8000 --> | |
<head> | |
<meta charset="utf-8"> |
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
license: gpl-3.0 |
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 stream = require('stream') | |
module.exports = split | |
function split(delim, emitTrailingIfEmpty) { | |
delim = delim || new Buffer('\n') | |
var trailing, delimLen = delim.length | |
return new stream.Transform({ | |
readableObjectMode: true, | |
transform: function(chunk, enc, cb) { |
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 AWS = require('aws-sdk') | |
var dynamo = new AWS.DynamoDB({endpoint: 'http://localhost:4567'}) | |
var params = { | |
AttributeDefinitions: [ // required | |
{ | |
AttributeName: 'test_id', // required | |
AttributeType: 'N' // required | |
}, { |
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
/ # npm install hiredis | |
npm WARN engine [email protected]: wanted: {"node":">= 0.8.0"} (current: {"node":"4.0.0-pre","npm":"2.14.2"}) | |
> [email protected] install /node_modules/hiredis | |
> node-gyp rebuild | |
gyp ERR! configure error | |
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead | |
gyp ERR! stack at install (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:66:16) | |
gyp ERR! stack at Object.self.commands.(anonymous function) [as install] (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:66:37) |
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 spawn = require('child_process').spawn; | |
var csp = require('js-csp'); | |
class Math { | |
constructor(readyCallback) { | |
this._readyCallback = readyCallback; | |
this._worker = spawn('6to5-node', ['worker.js']); | |
this._worker.stderr.pipe(process.stderr); | |
this._reqChan = csp.chan(); |
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
#!/usr/bin/env node | |
var path = require('path') | |
var fs = require('fs') | |
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); | |
require(lib + '/awslambda.js').start_runtime(); | |
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 util = require('util') | |
var Readable = require('stream').Readable | |
var request = require('request') | |
var async = require('async') | |
function PagingFetchStream(opts) { | |
Readable.call(this, {objectMode: true}) | |
opts = opts || {} | |
this.getIdsUrl = opts.getIdsUrl |