Skip to content

Instantly share code, notes, and snippets.


Zander Martineau mrmartineau

View GitHub Profile
tkrotoff /
Last active Jan 29, 2021
How I structure my tests

File structure

  • src/fooBar.js
  • src/fooBar.html
  • src/fooBar.scss
  • src/fooBar....
  • src/fooBar.test.js => npm run test
  • src/fooBar.test.e2e.js (if I have E2E tests - Puppeteer, Playwright...) => npm run test:e2e

Tests should not be separated from the source code (think autonomous modules).

tomhicks / plink-plonk.js
Last active Mar 20, 2021
Listen to your web pages
View plink-plonk.js
IanColdwater / twittermute.txt
Last active May 3, 2021
Here are some terms to mute on Twitter to clean your timeline up a bit.
View twittermute.txt
Mute these words in your settings here:

Everything I Know About UI Routing


  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
zephraph /
Last active Apr 1, 2020
A shell script to clean up all node_modules in projects that haven't been touched in a couple weeks.
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted
SEARCH_PATH="./Git" # Update this to the path where your code is stored
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)
Aidurber /
Last active Jul 1, 2020
A handy script to clean up a mac thanks to - Gant Laborde's article:
# Cleanup old node_modules
echo "Cleaning node_modules in projects older than 30 days"
find . -name "node_modules" -type d -mtime +30 | xargs rm -rf
echo "Done cleaning node_modules"
# Clean up homebrew
echo "Clean homebrew"
brew update && brew upgrade && brew cleanup
echo "Done cleaning homebrew"
sarahbethfederman / RichTextRenderer.js
Last active Feb 26, 2020
Using contentful with gatsby and react
View RichTextRenderer.js
import React from 'react';
import { Link as GatsbyLink } from 'gatsby';
import * as deepmerge from 'deepmerge';
import { INLINES, BLOCKS, MARKS } from '@contentful/rich-text-types';
import { documentToJSX } from './../scripts/documentToJSX';
import { getEntry } from './../scripts/getContentfulEntry';
const Link = ({ children, to, activeClassName, ...other }) => {
const internal = /^\/(?!\/)/.test(to);
MoOx /
Last active Apr 16, 2020
Matrix of existing React ui kit (more than 200 download/week, more than 200 stars)



  • ✏️ method changes this.
  • 🔒 method does not change this.


  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
Atinux / async-foreach.js
Last active Apr 30, 2021
JavaScript: async/await with forEach()
View async-foreach.js
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)