View filterKeys.js
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' }; |
View convert-img-to-base64.js
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); |
View combos-and-pairs.js
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); | |
} |
View lloyds.css
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; | |
} |
View hyper-sync-settings.json
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
{} |
View download-website.sh
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) |
View colors.json
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
{ | |
"black":"39/40/34", | |
"red":"249/38/114", | |
"green":"166/226/46", | |
"yellow":"244/191/117", | |
"blue":"102/217/239", | |
"magenta":"174/129/255", | |
"cyan":"161/239/228", | |
"white":"248/248/242", | |
"brightBlack":"117/113/94", |
View wallmaker.js
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
// do once per "row" (going down) | |
for ( let y=0; y<boxesDown; y++ ) { | |
// do once per "column" (going across) | |
for ( let x=0; x<boxesAcross; x++ ) { | |
// rx = top-left x coord of current square | |
let rx = x * size; | |
// ry = top-left y coord of current square | |
let ry = y * size; | |
// cx = centre point x coord of current square |
View throttle.js
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 throttle(fn, ms, scope) { | |
var last = 0; | |
var fn = function() { | |
var now = Date.now(); | |
if ( now - last > ms ) { | |
last = now; | |
fn.apply(scope, arguments); | |
} | |
}; | |
return scope ? fn.bind(scope) : fn; |
View Gulpfile.js
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, |
NewerOlder