Skip to content

Instantly share code, notes, and snippets.

View mrcleanandfresh's full-sized avatar

Kevin Dench mrcleanandfresh

  • Denver, USA
View GitHub Profile
@mrcleanandfresh
mrcleanandfresh / useMeasure.js
Created February 4, 2020 22:37 — forked from stolinski/useMeasure.js
useMeasure - taken from React Spring example
import { useRef, useState, useEffect } from 'react'
import ResizeObserver from 'resize-observer-polyfill'
export default function useMeasure() {
const ref = useRef()
const [bounds, set] = useState({ left: 0, top: 0, width: 0, height: 0 })
const [ro] = useState(() => new ResizeObserver(([entry]) => set(entry.contentRect)))
useEffect(() => (ro.observe(ref.current), ro.disconnect), [])
return [{ ref }, bounds]
}
@mrcleanandfresh
mrcleanandfresh / readme.md
Created December 30, 2015 16:43 — forked from hitautodestruct/readme.md
Generate a custom structure for Wordpress menus.

This gist is for showing an example of a custom wordpress menu.

If you want to get more from the menu item simply have a look at the $item object. i.e:

// Will return a large object with lots of props like title, url, description, id etc.
var_dump( $item );

This code works on Wordpress 4.1.1 as of 31st of March 2015

@mrcleanandfresh
mrcleanandfresh / fabfile.y
Created October 24, 2015 04:36 — forked from grega/fabfile.py
Sample Fabric 'fabfile' for deploying to multiple hosts. Using: `fab deploy stage` or `fab deploy live`. Deploy to live prompts the user to confirm (with 'y' or 'n') that they actually want to deploy. Deploy tasks runs git pull & any number of utility commands (eg. asset compilation, checking / fixing folder permissions etc).
from __future__ import with_statement
from fabric.api import env, local, settings, abort, run, cd, sudo
from fabric.contrib.console import confirm
# Hosts
def stage():
env.user = 'deploy_user'
env.hosts = ['xxx.xxx.xxx.xxx:22']
global code_dir
code_dir = '/var/www/stage.website.com' # no trailing slash