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
class Lightbulb_Interface { | |
// switch_on should have an arity of 0 | |
// it should turn on the thing. | |
switch_on() {} | |
// switch_off should have an arity of 0. | |
// it should turn off the thing. | |
switch_off() {} | |
} |
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 | |
# Loop over each found markdown file. | |
for file in content/*.md; do | |
# Check it's an actual readable file. | |
if [ -e "$file" ] ; then | |
# Get our 💩 together. | |
TEMPLATE=`cat template.html` | |
CONTENT=`cat "$file" | pandoc --no-highlight -f markdown` |
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 notifications = models.notifications | |
notifications | |
.find({whatever}) | |
.exec((err, notifs) => { | |
notifications.destroy({whatever}) | |
// ^- Notifications here is undefined because this block has a definition of notifications later. | |
// It is dereferenced from this local scope pending the definition below. | |
// This is a really simplified example. | |
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
// All the transform types. | |
const types = [ | |
"translate", | |
"translateX", | |
"translateY", | |
"scale", | |
"scaleX", | |
"scaleY", | |
"rotate", | |
"skew", |
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
function contrast_colour(hex) { | |
//- Get rid of any hashes. | |
var colour = hex.replace(/\#/g, "") | |
//- Get the luminance. | |
var R = parseInt(colour.substring(0, 2), 16) | |
var G = parseInt(colour.substring(2, 4), 16) | |
var B = parseInt(colour.substring(4, 6), 16) | |
// If it's over half the total of 765 (255 * 3), it's lighter |
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
<ifModule mod_rewrite.c> | |
RewriteEngine On | |
# Set up a rule for the Apple site association. | |
RewriteRule ^apple\-app\-site\-association$ /apple-app-site-association.php [L] | |
# If an existing asset or directory is requested go to it as it is | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d | |
RewriteCond %{REQUEST_URI} !^(bower_components|assets|apple\-app\-site\-association) |
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" | |
// used in benchmarks. | |
const SAMPLE = 5000000 | |
const Hoek = require('hoek') | |
const array = [] | |
for (let i = 0; i < SAMPLE; ++i) { | |
array.push(i * Math.floor(Math.random() * (10 - 1 + 1)) + 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
/** | |
* Convert a `Map` to a standard | |
* JS object recursively. | |
* | |
* @param {Map} map to convert. | |
* @returns {Object} converted object. | |
*/ | |
function map_to_object(map) { | |
const out = Object.create(null) | |
map.forEach((value, key) => { |
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
function blob_to_buffer(blob, callback) { | |
// Create a file reader instance. | |
const file_reader = new FileReader() | |
// Listen to when reading is finished and | |
// run the callback with a buffer. | |
file_reader.addEventListener("loadend", event => { | |
if (event.error) { | |
callback(event.error) | |
} |