Skip to content

Instantly share code, notes, and snippets.

Blair Garrett blairg

Block or report user

Report or block blairg

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
blairg / package-manager-tests-results.txt
Last active Apr 29, 2018
Raw results from the package manager tests
View package-manager-tests-results.txt
npm i - without cache
Total 43.9220s
Total 50.8631s
Total 44.4800s
Total 44.8371s
Total 50.8278s
Total 50.2065s
Total 52.7080s
npm ci - without cache
Total 27.7528s
blairg /
Last active Apr 29, 2018
Script to test npm i, npm ci, yarn and pnpm. With and without cache. Also, without lock files and existing node_modules too.
rm -rf node_modules/
npm cache clear --force
npm i
echo "npm i - without cache" >> npmbg7
while [ $i -lt 7 ]
npm cache clear --force
blairg / hackerlite-disqus.html
Created Jan 28, 2018
Hackerlite - disqus file
View hackerlite-disqus.html
<div id="disqus_thread"></div>
window.addEventListener('message', receiveMessage, false);
function receiveMessage(event)
if ( {
var msg;
try {
msg = JSON.parse(;
} catch (err) {
blairg / jest.test.js
Created Dec 26, 2017
Migrate from Mocha to Jest - Example
View jest.test.js
/* eslint-disable no-undef */
import HttpStatus from 'http-status';
import cache from 'memory-cache';
import { fn as momentProto } from 'moment';
import ApiController from './../../../src/server/controllers/api';
describe('server/controllers/api', () => {
describe('server/controllers/api', () => {
describe('get/handler', () => {
blairg / index.js
Created Dec 22, 2017
Mock event.preventDefault() with Jest
View index.js
static async handleDelete(event) {
let success = true;
await Axios.delete('/todos')
.then(() => {})
.catch(error => {
success = false;
blairg / objectMergeES5.js
Created Sep 20, 2017
Example of how to merge the values of 2 objects in JavaScript
View objectMergeES5.js
'use strict';
var _deepDiff = require('deep-diff');
var _objectAssignDeep = require('object-assign-deep');
var _objectAssignDeep2 = _interopRequireDefault(_objectAssignDeep);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
You can’t perform that action at this time.