Skip to content

Instantly share code, notes, and snippets.

View mrmartineau's full-sized avatar
👋
Aho Young Warrior

Zander Martineau mrmartineau

👋
Aho Young Warrior
View GitHub Profile
@tkrotoff
tkrotoff / HowToTest.md
Last active January 29, 2021 22:19
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
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet

Everything I Know About UI Routing

Definitions

  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
zephraph / clean_node_modules.sh
Last active June 13, 2023 13:53
A shell script to clean up all node_modules in projects that haven't been touched in a couple weeks.
#!/bin/bash
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
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)
@freshyill
freshyill / .eleventyconfig.js
Last active January 23, 2023 10:49
JSON feed template for eleventy-plugin-rss
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
// Lots of other stuff probably goes here
eleventyConfig.addCollection("allUpdates", function(collection) {
return collection.getFilteredByGlob(["posts/*.md", "photos/*.md", "notes/*.md"]).sort(function(a, b) {
return b.date - a.date;
});
@Aidurber
Aidurber / cleanup.sh
Last active September 29, 2022 13:14
A handy script to clean up a mac thanks to - Gant Laborde's article: https://medium.freecodecamp.org/how-to-free-up-space-on-your-developer-mac-f542f66ddfb
# 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
sarahbethfederman / RichTextRenderer.js
Last active May 12, 2021 17:56
Using contentful with gatsby and react
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);
@whoisryosuke
whoisryosuke / calculateGridWidth.js
Created January 7, 2019 03:28
JS / CSS-in-JS - Calculate width of grid element using column size and number of columns (e.g. [1,2] = 50% column)
/**
* Calculates width of a grid element.
*
* Accepts an array of two numbers, the column size
* and total number of columns (respectively).
*
* Uses the total columns to determine total width,
* then multiplies by the column size to calculate
* current column width.
*
@MoOx
MoOx / react-ui-kit-comparator.md
Last active April 16, 2020 20:36
Matrix of existing React ui kit (more than 200 download/week, more than 200 stars)