Skip to content

Instantly share code, notes, and snippets.

View jedrichards's full-sized avatar
⛰️

Jed Richards jedrichards

⛰️
View GitHub Profile
@jedrichards
jedrichards / LoginCallback.js
Created October 30, 2018 08:55
gatsby-plugin-auth0
import React, { Component } from 'react'
import { Auth0Context } from './'
class LoginCallbackInner extends Component {
componentDidMount() {
this.props.auth0.onLogin()
}
render() {
var randomChars = "jldfsifnJSODNBD~±§1234567890!@£$%^&*()-=_+,./<>?";
function easeOut (t,d,p) {
return 1-Math.pow(1-(t/d),p);
}
function randomInt (min,max) {
return Math.floor(Math.random()*(max-min+1))+min;
}

Keybase proof

I hereby claim:

  • I am jedrichards on github.
  • I am jedrichards (https://keybase.io/jedrichards) on keybase.
  • I have a public key whose fingerprint is D1AF 6344 8674 3A46 A647 1904 689C 2EA8 416A 1AA1

To claim this, I am signing this object:

@jedrichards
jedrichards / README.md
Created May 23, 2014 16:20
generators

ES6 Generators

  • Available in ES6 Harmony
  • Present in Node 0.11 unstable and above
  • Enable via the --harmony or --harmony-generators flag in 0.11

Intro

Generators are constructor functions for iterators.

Debug Workshop

General tips

❉ Create a new user in Chrome just for use with debugging, ensures no plugins or extensions are adding JS to the page and confusing the issue. Extension code and iframes will show up when you're trying to profile code and get in the way. You're aiming for as close to a totally vanilla browser tab as possible.

❉ Be aware Chrome dev tools add a fair bit of CPU/memory overhead to the page

❉ "Art" of debugging: replicate, isolate, eliminate. Replication is the hardest part. "Works for me" not really an acceptable answer.

@jedrichards
jedrichards / gist:7916199
Last active December 31, 2015 01:49
Marionette One Page Web Apps

Marionette One Page Web Apps

Essential Elements

A Grunt build process

  • General development is done on your unbuilt files
  • Set up a watch task to continually compile CSS
  • Don't attempt to build and optimise the entire site in a watch task, it'll take too long
  • When ready to deploy your site then compile/uglify/minify/concat into a dedicated 'build' folder
@jedrichards
jedrichards / gist:5734577
Last active December 18, 2015 05:39
Camping expense computation
Creating members
----------------
Jed
Natty
Jamie
Owen
Laura
Nicci
Oli
Aysha
// extend.js
define(function (require) {
var _ = require("vendor/underscore");
var ctor = function () {};
var inherits = function (parent,protoProps,staticProps) {
var child;
if (protoProps && protoProps.hasOwnProperty("constructor")) {
@jedrichards
jedrichards / gist:4141229
Created November 24, 2012 20:09
Sublime Text 2 User Settings
{
"auto_complete_delay": 0,
"caret_style": "blink",
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"find_selected_text": true,
"fold_buttons": false,
"font_face": "Ubuntu Mono",
"font_options":
[
"no_bold",