Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Mackintosh agm1984

View GitHub Profile
@sw-yx
sw-yx / react-router-state-manager.jsx
Last active Sep 24, 2020
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
frumbert / function.js
Created Aug 9, 2017
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);
reader.readAsDataURL(blob);
})
}
@gotnospirit
gotnospirit / main.js
Created Jul 28, 2017
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',
@tahirtaous
tahirtaous / Add Custom CSS to Anchors links in WordPress
Last active Nov 16, 2021
How to Add Custom CSS Class Directly to Menu Item (Anchors) Links in WordPress Theme
View Add Custom CSS to Anchors links in WordPress
@stas
stas / vsftpd.conf
Created Feb 26, 2010
VSFTPD.CONF for virtual users with write/read/delete permissions
View vsftpd.conf
###
# 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