Skip to content

Instantly share code, notes, and snippets.

Ben Frain benfrain

Block or report user

Report or block benfrain

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
benfrain / gulpfile.js
Last active May 24, 2020
Gulp file v3.9.3
View gulpfile.js
var gulp = require("gulp");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var postcss = require("gulp-postcss");
var cssnano = require("cssnano");
var notify = require("gulp-notify");
var postcssMixins = require("postcss-mixins");
var simplevars = require("postcss-simple-vars")();
var autoprefixer = require("autoprefixer");
var browserSync = require("browser-sync");
benfrain / init.vim
Created Apr 8, 2020
Lightline config (for init.vim)
View init.vim
"Plug 'itchyny/lightline.vim'
" Lightline config
"let g:lightline = {
"\ 'colorscheme': 'nord',
"\ 'active': {
"\ 'left': [ [ 'mode', 'paste' ],
"\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ],
"\ 'right': [ [ 'lineinfo' ],
"\ [ 'percent' ],
benfrain / coc-hints-test.ts
Last active Apr 7, 2020
Testing Coc hints
View coc-hints-test.ts
const cake = {
icing: true,
type: "sponge"
const message =
"This is a " +
cake.type +
" cake. " +
"It has " +
benfrain / init.vim
Last active May 4, 2020
init.vim for neovim config
View init.vim
if &compatible
set nocompatible " Be iMproved
nnoremap <SPACE> <Nop>
let mapleader=" "
" Required:
filetype plugin indent on
benfrain / postcss.config.js
Created Mar 18, 2019
PostCSS Config file (for Parcel)
View postcss.config.js
var colors = require("./global/css/variables");
module.exports = {
plugins: [
require("postcss-simple-vars")({ variables: colors }),
View tsconfig.json
"compilerOptions": {
"module": "ES6",
"noImplicitAny": true,
"allowJs": true,
"lib": ["ES2016"],
"target": "ES6"
benfrain / animateNumericValues.ts
Last active Feb 7, 2019
JS utility to animate numeric values from one value to another
View animateNumericValues.ts
* [animateNumericValues interpolates from one number to another with a max of 60 integers per second]
* @param {Element} element [The DOM element that will get interpolated]
* @param {number} fromValue [the first value]
* @param {number} toValue [the final value]
* @param {number} speed [how long the animation should take in milliseconds]
* @param {delay} delay [any delay before it starts counting up]
* @param {string} appendString [optional string that gets appended to the value. E.g. "%"]
function animateNumericValues({
benfrain / .zshrc
Last active Mar 18, 2020
zshrc file
View .zshrc
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH:$HOME/.local/bin
# Added at request of Lee Armitage on network team to allow React Native to run
# source /Users/benfrain/.bash_profile
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
benfrain / gulp.fork.js
Last active Apr 26, 2020
Gulp forking a stream (e.g. send different files to different dests)
View gulp.fork.js
gulp.task("ts", function() {
// These would be the names of two source files for example
tsRootFiles = ["rab", "buildRab"];
tsRootFiles.forEach(tsFile => {
let stream = gulp
benfrain / wrap.ts
Last active Sep 10, 2018
Finds numbers and currency codes and wraps them in an element
View wrap.ts
* @param inputString a string of text that may or may not include numbers and a currency unit
* @returns a string of text where a number followed by a currency unit is wrapped in spans for styling
function wrapUnits(inputString: string) {
let regNum = new RegExp("([0-9]+)", "gm");
let regUnit = new RegExp("(GBP|EUR)", "gm");
// It needs to match the currency unit or we are not interested
if (inputString.match(regUnit)) {
You can’t perform that action at this time.