Title | Subtitle | Authors | JSTOR Discipline 1 |
---|---|---|---|
Tracking Rural Change | "Community, Policy and Technology in Australia, New Zealand and Europe" | Socio |
This file contains 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
let fs = require('fs'); | |
let archiver = require('archiver'); | |
let request = require('request'); | |
let archive = archiver('zip', { store: true}); | |
let out = fs.createWriteStream(__dirname + '/sports.zip'); | |
let sport1 = request('http://lorempixel.com/400/200/sports/1/'); | |
let sport2 = request('http://lorempixel.com/400/200/sports/2/'); |
This file contains 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 cliArgs = process.argv.slice(2); | |
const key = cliArgs[0]; | |
const val = cliArgs[1]; | |
function parseJSON(string) { | |
const sanitised = string.replace(/\s\$\w*/g, substr => `"__SANITISED__${substr}"`); | |
return JSON.parse(sanitised); | |
} |
require 'sinatra' (1)
get '/hi' do (2) (3)
"Hello World!"
end
-
Library import
-
URL mapping
This file contains 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
## Personas | |
## Subjects/Verbs :: Characters/Action | |
## Sentences should flow old information -> new | |
## Keep topics coherent | |
## Use topics to assign responsibility |
This file contains 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
/// <reference types="node" /> | |
declare module 'watchr' { | |
import {Stats, FSWatcher} from 'fs'; | |
import {EventEmitter} from 'events'; | |
export type ChangeType = 'update' | 'create' | 'delete'; | |
export type State = 'pending' | 'active' | 'deleted' | 'closed'; |
This file contains 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 firstTruthy<T>(promises: Array<Promise<any>>): Promise<T|null> { | |
return new Promise((resolve, reject) => { | |
// If any promise returns truthy value, immediately resolve with it | |
promises.forEach(async promise => { | |
const result = await promise; | |
if (!!result) resolve(result); | |
}); | |
// If any promise rejects, immediately throw the error | |
Promise.race(promises).catch(reject); |
This file contains 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
// Get a WebGL context | |
import {Perhaps, None, Some, Any} from 'highly-questionable'; | |
const canvas = document.createElement('canvas'); | |
const context = Perhaps | |
.of(canvas.getContext('webgl2')) | |
.or(canvas.getContext('webgl')) | |
.orFrom(()=> canvas.getContext('experimental-webgl')); |
This file contains 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 throttleGroup(fn, count, delay) { | |
let queue = []; | |
let nextDrain = null; | |
function scheduleDrain() { | |
nextDrain = window.setTimeout(drainQueue, delay); | |
} | |
function drainQueue() { | |
const groupSize = Math.min(count, queue.length); |
This file contains 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 group (rows, discriminant) { | |
const asMap = rows.reduce( | |
(acc, item) => { | |
const key = item[discriminant] | |
return { | |
...acc, | |
[key]: acc[key] ? [...acc[key], item] : [item] | |
} | |
}, | |
{} |