Skip to content

Instantly share code, notes, and snippets.


Adam Mackintosh agm1984

View GitHub Profile
gotnospirit / main.js
Created July 28, 2017 12:22
React Router v4 + React Transition Group v2
View main.js
import React from 'react'
import { render } from 'react-dom'
import { BrowserRouter, Route, Link } from 'react-router-dom'
import { TransitionGroup, Transition } from 'react-transition-group'
import matchPath from 'react-router-dom/matchPath'
const routes = [{
key : 'home',
path : '/',
content : 'Homepage',
stas / vsftpd.conf
Created February 26, 2010 14:46
VSFTPD.CONF for virtual users with write/read/delete permissions
View vsftpd.conf
# VSFTPD.CONF for virtual users with write/read/delete permissions
tahirtaous / Add Custom CSS to Anchors links in WordPress
Last active December 12, 2021 18:27
How to Add Custom CSS Class Directly to Menu Item (Anchors) Links in WordPress Theme
View Add Custom CSS to Anchors links in WordPress
swyxio / react-router-state-manager.jsx
Last active July 26, 2022 10:43
Sync your state to your query params for copy-pastable state-in-URLs. React Router, Gatsby, and Svelte versions
View react-router-state-manager.jsx
// note - this was my rough working prototype, but still left some artifacts in the query params.
// todo: also need to debounce the history pushes
// see comments for production Gatsby and Svelte versions which delete nondefault keys in the query params
import React from 'react'
import queryString from "query-string"
export const connectRouterState = defaultURLState => Component => props => {
const { history, location } = props
// note: do not nest objects in URL state
frumbert / function.js
Created August 9, 2017 09:18
blob to dataurl, because I keep forgetting how to do it!
View function.js
function blobToDataURL(blob) {
return new Promise((fulfill, reject) => {
let reader = new FileReader();
reader.onerror = reject;
reader.onload = (e) => fulfill(reader.result);