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
#!/bin/bash | |
# works with a file called VERSION in the current directory, | |
# the contents of which should be a semantic version number | |
# such as "1.2.3" | |
# this script will display the current version, automatically | |
# suggest a "minor" version update, and ask for input to use | |
# the suggestion, or a newly entered value. |
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
@font-face { | |
font-family: "Lloyds Jack Light"; | |
src: url("https://www.lloydsbank.com/assets/fonts/LloydsBankJackLight/lloyds_bank_jack-lightWEB.woff") format('woff'); | |
} | |
@font-face { | |
font-family: "Lloyds Jack Light"; | |
src: url("https://www.lloydsbank.com/assets/fonts/LloydsBankJackMedium/lloyds_bank_jack-mediumWEB.woff") format('woff'); | |
font-weight: bold; | |
} |
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 filterKeys = (obj, keys) => | |
Object.entries(obj).reduce( | |
(acc, [k, v]) => (keys.includes(k) ? acc : { ...acc, [k]: v }), | |
{} | |
); | |
/** | |
// Usage: | |
const myObject = { foo: 'foo', bar: 'bar', baz: 'baz', eck: 'eck' }; |
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
/** | |
* Object.spawn for a more terse form of Object.create, | |
* with the super added bonus of giving all overriden | |
* functions a "parent" property which refers back to | |
* thing it was overriding ... like "parent" or "super" | |
* in classical OOP | |
* | |
* @link http://howtonode.org/prototypical-inheritance |
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
#!/bin/bash | |
wget -E -k -r -p -e robots=off https://some-site.com/docs/ | |
#### Note the following arguments: | |
# -E : converts downloaded HTML filenames to have a ".html" suffix | |
# -k : converts internal links within downloaded files to point to other downloaded files | |
# -r : recursively download by scanning for internal links in pages | |
# -p : download "page requisites", i.e. images, styles, scripts | |
# -e robots=off : ignore robots.txt (because some sites use it to avoid indexing) |
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
// This runs in a browser, | |
// it's usable with WebDriver as an injected script | |
function convertImagetoBase64(selector) { | |
const image = document.querySelector(selector); | |
const canvas = document.createElement("canvas"); | |
const context = canvas.getContext("2d"); | |
const { width, height } = image; | |
canvas.width = width; | |
canvas.height = height; | |
context.drawImage(image, 0, 0, width, height); |
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
/** | |
* Semantically bump a version number, defaults to "minor". | |
* | |
* If your version number includes a prefix, (e.g. "v" in "v0.1.0") | |
* this will be preserved and returned. Any suffix (e.g. "-beta" | |
* in "v0.5.2-beta") will be lost. | |
* | |
* You can provide version numbers in the following formats: | |
* '0.1.2', 'v1.2-patched', '2.3', '3', 4.1, 5 | |
* And you will get back (assuming a minor bump): |
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
var gulp = require('gulp'), | |
connect = require('connect'), | |
serveStatic = require('serve-static'), | |
livereloadInjector = require('connect-livereload'), | |
livereloadTinyLR = require('tiny-lr'), | |
path = require('path'), | |
gutil = require('gulp-util'); | |
var FOLDER_DEST = '.', | |
PORT_SERVER = process.env.PORT || 8888, |
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
/* | |
See http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
and http://blog.joelambert.co.uk/2011/06/01/a-better-settimeoutsetinterval/ | |
*/ | |
define([ | |
], | |
function () { | |
'use strict'; |
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 _ = require('lodash'); | |
function getPairs(arr) { | |
let rCount = 0; | |
const results = arr.map(i => [i]); | |
const f = (base, rest) => { | |
for (let i = 0, max = rest.length; i < max; i += 1) { | |
const entry = [base, rest[i]]; | |
results.push(entry); | |
} |
NewerOlder