Skip to content

Instantly share code, notes, and snippets.

View agm1984's full-sized avatar

Adam Mackintosh agm1984

View GitHub Profile
@swyxio
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
// 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
frumbert / function.js
Created August 9, 2017 09:18
blob to dataurl, because I keep forgetting how to do it!
function blobToDataURL(blob) {
return new Promise((fulfill, reject) => {
let reader = new FileReader();
reader.onerror = reject;
reader.onload = (e) => fulfill(reader.result);
reader.readAsDataURL(blob);
})
}
@gotnospirit
gotnospirit / main.js
Created July 28, 2017 12:22
React Router v4 + React Transition Group v2
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',
@tahirtaous
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
@stas
stas / vsftpd.conf
Created February 26, 2010 14:46
VSFTPD.CONF for virtual users with write/read/delete permissions
###
# VSFTPD.CONF for virtual users with write/read/delete permissions
###
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES