- What is the relationship between Node.js and V8? Can Node work without V8?
- How come when you declare a global variable in any Node.js file it's not really global to all modules?
- When exporting the API of a Node module, why can we sometimes use exports and other times we have to use module.exports?
- Can we require local files without using relative paths?
- Can different versions of the same package be used in the same application?
- What is the Event Loop? Is it part of V8?
- What is the Call Stack? Is it part of V8?
- What is the difference between setImmediate and process.nextTick?
- How do you make an asynchronous function return a value?
- Can callbacks be used with promises or is it one way or the other?
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
height: 600 |
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
hg clone https://bitbucket.org/tiax/bitbucket-issues-cli # Fork repo with support for Git on Bitbucket | |
cd bitbucket-issues-cli | |
hg patch ../patch-bitbucket-issues-cli-1 |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>vue-i18next demo</title> | |
<script src="https://rawgit.com/i18next/i18next/master/i18next.min.js"></script> | |
<script src="https://unpkg.com/vue/dist/vue.js"></script> | |
<script src="https://rawgit.com/rse/vue-params/master/vue-params.js"></script> | |
<script src="https://rawgit.com/rse/vue-i18next/master/vue-i18next.js"></script> | |
</head> |
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
.autocomplete-suggestions { | |
text-align: left; cursor: default; border: 1px solid #ccc; border-top: 0; background: #fff; box-shadow: -1px 1px 3px rgba(0,0,0,.1); | |
/* core styles should not be changed */ | |
position: absolute; display: none; z-index: 9999; max-height: 254px; overflow: hidden; overflow-y: auto; box-sizing: border-box; | |
} | |
.autocomplete-suggestion { position: relative; padding: 0 .6em; line-height: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.02em; color: #333; } | |
.autocomplete-suggestion b { font-weight: normal; color: #1f8dd6; } | |
.autocomplete-suggestion.selected { background: #f0f0f0; } |
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 https = require('https'); | |
const querystring = require('querystring'); | |
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; | |
function sendSms (message) { | |
var qs = querystring.stringify({ | |
user: process.env.free_fr_user_account, | |
pass: process.env.free_fr_sms_key, | |
msg: message |
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"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<title>Simple Map with GeoJSON markers</title> | |
<link rel="stylesheet" href="http://openlayers.org/en/v3.18.2/css/ol.css" type="text/css"> | |
<style> | |
html, body { | |
height: 100%; |
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 sleep (dur) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(), dur); | |
}); | |
} | |
async function yay () { | |
console.log('i am sleepy'); | |
await sleep(5000); | |
console.log('i need more sleep'); |
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
'use strict'; | |
// Idea mainly borrowed from https://stackoverflow.com/a/30883005 | |
const Promise = require('bluebird'); // Not required if you prefer using native promise | |
const exec = require('child_process').exec; | |
function promiseExec(command) { | |
var child = exec(command); | |
return new Promise(function (resolve, reject) { | |
child.addListener("error", reject); | |
child.stderr.on('data', function (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
<OGRVRTDataSource> | |
<OGRVRTLayer name="nga_rivers"> | |
<SrcDataSource>rivers.gpkg</SrcDataSource> | |
<SrcLayer>rivers</SrcLayer> | |
<SrcSQL>SELECT * FROM rivers</SrcSQL> | |
</OGRVRTLayer> | |
</OGRVRTDataSource> |