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
| BPromise.all(friendIdList.filter(Boolean).map(obsId => docClient.queryAsync(params))) | |
| .then(feedList => _.sortBy(_.flatten(feedList), 'timestamp').reverse()); |
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
| sns.createPlatformEndpointAsync({ | |
| PlatformApplicationArn: applicationArn, | |
| Token: deviceId, | |
| }); | |
| /* send the notification (not needed) */ | |
| sns.publishAsync({ | |
| MessageStructure: "json", | |
| Message: JSON.stringify({ | |
| APNS: JSON.stringify({ |
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 Promise = require("bluebird"); | |
| const docClient = { | |
| put(x, cb) { | |
| setTimeout(() => { | |
| if (1 == x) { | |
| cb(null, "good"); | |
| } | |
| else { | |
| cb(new Error("bad")); | |
| } |
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
| function authenticateUser(details, callback) { | |
| if (details) { | |
| return callback.onSuccess(); | |
| } | |
| return callback.onFailure(); | |
| } | |
| new Promise((onSuccess, onFailure) => { | |
| authenticateUser(true, { | |
| onSuccess, |
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
| angular.module('starter', ['ionic']) | |
| .run(["LocationService", async LocationService => { | |
| const coords = await LocationService.getPosition(); | |
| console.log(coords); | |
| }]) | |
| .service("LocationService", ["$window", "$q", ($window, $q) => ( | |
| { | |
| getPosition() { | |
| const dfd = $q.defer(); |
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 express = require("express"); | |
| const userRouter = express.Router(); | |
| const groupRouter = express.Router(); | |
| const app = express(); | |
| userRouter.get("/user", (req, res) => res.end("user")); | |
| groupRouter.get("/group", (req, res) => res.end("group")); | |
| app.use("/api", userRouter); | |
| app.use("/api", groupRouter); |
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
| redisconfig_1 | _._ | |
| redisconfig_1 | _.-``__ ''-._ | |
| redisconfig_1 | _.-`` `. `_. ''-._ Redis 3.0.3 (00000000/0) 64 bit | |
| redisconfig_1 | .-`` .-```. ```\/ _.,_ ''-._ | |
| redisconfig_1 | ( ' , .-` | `, ) Running in standalone mode | |
| redisauth_1 | _._ | |
| redisconfig_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | |
| redisauth_1 | _.-``__ ''-._ | |
| redisconfig_1 | | `-._ `._ / _.-' | PID: 1 | |
| redisauth_1 | _.-`` `. `_. ''-._ Redis 3.0.3 (00000000/0) 64 bit |
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 | |
| cd /home/ec2-user/ingest | |
| ./run.sh | |
| aws --region=us-east-1 autoscaling terminate-instance-in-auto-scaling-group --instance-id $(curl http://169.254.169.254/latest/meta-data/instance-id) --should-decrement-desired-capacity |
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
| import delay from "timeout-as-promise" | |
| (async () => { | |
| let actions = (new Array(50)).fill(0).map(() => Math.random() * (1000 - 500) + 500); | |
| let promises = []; | |
| try { | |
| actions.forEach(time => promises.push( | |
| async () => { | |
| try { |
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 fs = require("fs"); | |
| const JSONStream = require("JSONStream"); | |
| const parser = JSONStream.parse('*'); | |
| const stream = fs.createReadStream("./bl"); | |
| stream.pipe(parser); | |
| parser.on("data", data => { | |
| let len = Buffer.byteLength(data.result); | |
| if (len > 500000) { |