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
Promise.all([ 1000, 2000, 3000 ].map(async n => await new Promise(r => setTimeout(() => { | |
console.log(n) | |
r() | |
}, n)))) |
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 | |
for d in ./*/ | |
do | |
echo "" | |
echo " -------------------------------------------- " | |
echo "" | |
echo "" | |
cd "$d" | |
echo "SUBDIR --> $d" | |
echo "" |
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
chmod +x dist/index.js | |
cmd="[Unit]\n" \ | |
"Description=[service]\n" \ | |
"After=network.target\n" \ | |
"\n" \ | |
"[Service]\n" \ | |
"ExecStart=/home/ubuntu/[user]/dist/index.js\n" \ | |
"Restart=always\n" \ | |
"User=myUser\n" \ |
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 dgram from 'dgram' | |
const procId = process.argv[2] | |
const myPort = process.argv[3] | |
const theirPort = process.argv[4] | |
if (!procId) { | |
throw new Error("must supply a procId as the first argument") | |
} | |
if (!myPort) { |
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 Hapi from 'hapi' | |
import Good from 'good' | |
const { | |
connection, | |
register, | |
route, | |
start | |
} = new Hapi.Server() |
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 _ = require('lodash'); | |
var today = new Date('9/30/2014'); | |
var dayOfWeek = "tuesday"; | |
var weekNumber = 4; | |
console.log(getCurrentAndNext(today, dayOfWeek, weekNumber)); | |
function getCurrentAndNext(today, dayOfWeek, weekNumber) { | |
var result = { current: void 0, next: void 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
#include <node.h> | |
using namespace v8; | |
struct point { | |
int x; | |
int y; | |
}; | |
void pointerFunction(point* p) { |