Skip to content

Instantly share code, notes, and snippets.

View joelgriffith's full-sized avatar
💻
Turns out I'm really good at computers

Joel Griffith joelgriffith

💻
Turns out I'm really good at computers
View GitHub Profile
@joelgriffith
joelgriffith / navalia-coverage.js
Last active July 8, 2017 20:38
Coverage on Navalia Docs
const { Chrome } = require('navalia');
const chrome = new Chrome();
async function checkCoverageOnPage() {
// Note that we've set `coverage: true` as a 2nd parameter, this will instrument Chrome appropriately
await chrome.goto('https://joelgriffith.github.io/navalia/', { coverage: true });
await chrome.focus('#search-input');
await chrome.type('#search-input', 'coverage');
const stats = await chrome.coverage('https://www.google-analytics.com/analytics.js');
@joelgriffith
joelgriffith / click.js
Created July 8, 2017 20:25
Navalia goto then click
const { Chrome } = require('navalia');
const chrome = new Chrome();
async function interactWithSearch() {
await chrome.goto('https://joelgriffith.github.io/navalia/');
await chrome.focus('#search-input');
await chrome.type('#search-input', 'coverage');
return chrome.done();
}
interactWithSearch();
@joelgriffith
joelgriffith / goto.js
Last active July 11, 2017 16:36
Launching Navalia
const { Chrome } = require('navalia');
const chrome = new Chrome();
chrome.goto('https://www.google.com')
.then(() => chrome.done());
@joelgriffith
joelgriffith / index.jsx
Last active June 23, 2017 12:25
apollo-client in your reducer tree as opposed to HOC
// External dependencies
import React from 'react';
import thunk from 'redux-thunk';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { routerReducer } from 'react-router-redux';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
import ApolloClient, { createNetworkInterface } from 'apollo-client';
" Preferences
set number
syntax on
set nocompatible " be iMproved, required
filetype off " required
set tabstop=4
set softtabstop=4
" Set tabs to a > character
set list
@joelgriffith
joelgriffith / gist:dc4024a718fa0e9a1bd2
Created January 5, 2015 16:40
Change Shell to ZSH when passwords aren't known
# Mount FS as read/write
mount -rw -o remount /
# Delete old passwd...
sudo passwd -d <USERNAME>
# Set passwd
passwd
# Set shell!
@joelgriffith
joelgriffith / Sinon-chain.js
Created December 1, 2014 15:56
Chaining Sinon Stubs
/**
* test.mpsec.js
*/
var sinon = require('sinon');
var expect = require('chai').expect;
var rewire = require('rewire');
var main = rewire('main');
var CoolModuleMock = (function() {
function CoolModuleMock() {}
@joelgriffith
joelgriffith / object-watch.js
Last active August 29, 2015 13:57 — forked from eligrey/object-watch.js
Object Watch Polyfill
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*
* Module Wrapper
*/
(function (base, factory) {
'use strict';
// RequireJS
if (typeof define === 'function' && define.amd) {
define(factory);
@joelgriffith
joelgriffith / Module.js
Last active August 29, 2015 13:55
The End-all JavaScript Module Wrapper
/*
* The end-all module detection/exportation
*/
(function(base, factory) {
// RequireJS
if (typeof define === "function" && define.amd) {
define(factory);
// CommonJS