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
| async function foo() { | |
| const userId = 42; | |
| const user = await User.findById(userId); | |
| return user.name; | |
| } | |
| function foo() { | |
| const userId = 42; |
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
| async function foo() { | |
| throw new Error('oops!'); | |
| } | |
| function foo() { | |
| return new Promise((resolve, reject) => { | |
| reject(new Error('oops!')); | |
| }); | |
| } |
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
| async function foo() { | |
| return 42; | |
| } | |
| function foo() { | |
| return new Promise((resolve, reject) => { | |
| resolve(42); | |
| }); | |
| } |
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
| app.get('/', async (ctx) => { | |
| const sessionId = ctx.get('session-id'); | |
| const session = await Session.findById(sessionId); | |
| const user = await User.findById(session.userId); | |
| ctx.body = `Hello, ${user.name}!`; | |
| }); |
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
| app.get('/', (req, res, next) => { | |
| const sessionId = req.get('session-id'); | |
| Session.findById(sessionId).then((session) => { | |
| return User.findById(session.userId); | |
| }).then((user) => { | |
| res.send(`Hello, ${user.name}!`); | |
| }).catch((err) => next(err)); | |
| }); |
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
| app.get('/', (req, res, next) => { | |
| const sessionId = req.get('session-id'); | |
| Session.findById(sessionId, (err, session) => { | |
| if (err) { | |
| return next(err); | |
| } | |
| User.findById(session.userId, (err, user) => { | |
| if (err) { |
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 app = express(); | |
| app.get('/', (req, res) => { | |
| res.send('Hello!'); | |
| }); |
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
| contract VCStartup { | |
| string public name = 'VC Startup'; | |
| string public symbol = '%'; | |
| uint8 public decimals = 6; | |
| uint constant totalShares = 100000000; | |
| // percent owned by each shareholder | |
| mapping (address => uint) public balanceOf; | |
| // array of owners |
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
| from django.core.serializers.json import DjangoJSONEncoder | |
| from django.template import Library | |
| from json import dumps as json_dumps | |
| register = Library() | |
| @register.filter | |
| def json(data): | |
| """ |
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 | |
| set -ex | |
| apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
| echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list | |
| apt-get update | |
| apt-get install -y linux-image-extra-$(uname -r) docker-engine | |
| docker run -d -v bitcoin_data:/data --name bitcoin --net host --restart always amacneil/bitcoin | |
| reboot |