Late 2016 consisted of mostly module diving. Topics of focus related mainly to hyperamp and hyperblog, two experimental hypermodul.es projects.
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
{ | |
"folders": | |
[ | |
{ | |
"path": ".", | |
} | |
], | |
"settings": { | |
"project_syntaxes": [ | |
{ |
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
0x2000d583cfc8919912e5C1eBb4B5C2c346e7324A |
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
// Generate a random integer r with equal chance in min <= r < max. | |
function randomInt(min, max) { | |
var range = max - min; | |
if (range <= 0) { | |
throw new Exception('max must be larger than min'); | |
} | |
var requestBytes = Math.ceil(Math.log2(range) / 8); | |
if (!requestBytes) { // No randomness required | |
return min; | |
} |
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
// https://ballpit.github.io/website/pics.zip | |
const fs = require('fs') | |
const get = require('simple-get') | |
const pump = require('pump') | |
const path = require('path') | |
get('https://ballpit.github.io/website/pics.zip', (err, res) => { | |
if (err) throw err |
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
--- | |
# Thanks halberom! | |
# http://blog.halberom.co.uk/ansible_yaml_syntax.html | |
- hosts: foo | |
tasks: | |
- name: single line plain style | |
file: path=/tmp/foo state=touch | |
- name: multi line plain style | |
file: path=/tmp/foo |
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
export class SafeURL extends URL { | |
constructor(url, base) { | |
super( | |
url.replace(/^(http(s?):\/\/)?/, 'http$2://'), | |
base | |
); | |
} | |
} |
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
CREATE EXTENSION IF NOT EXISTS citext; | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
CREATE TABLE users ( | |
id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc(), | |
username citext UNIQUE NOT NULL, | |
email citext UNIQUE NOT NULL, | |
email_confirmed BOOLEAN NOT NULL DEFAULT false, | |
password text | |
); |
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
CREATE EXTENSION citext; | |
CREATE DOMAIN email_address AS citext | |
CHECK ( | |
value ~ '^[a-zA-Z0-9.!#$%&''*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$' | |
); | |
CREATE TABLE users ( | |
id INT GENERATED ALWAYS AS IDENTITY primary key, |
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
test 123 |