Skip to content

Instantly share code, notes, and snippets.

🏄

Jared Williams jaredwilli

🏄
Block or report user

Report or block jaredwilli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jaredwilli
jaredwilli / index.js
Created Nov 25, 2017
HOC boiled eggs
View index.js
import React, { Component, PropTypes } from 'react'
import window from 'global/window'
import wrapDisplayName from 'recompose/wrapDisplayName'
import { createChangeEmitter } from 'change-emitter'
export const reactHOC = BaseComponent => {
return class ReactHOC extends Component {
static displayName = wrapDisplayName(BaseComponent, 'ReactHOC')
static propTypes = {
b: PropTypes.bool,
@jaredwilli
jaredwilli / asyncToReact.js
Created Nov 24, 2017 — forked from sebmarkbage/asyncToReact.js
Convert Async Function to React Component
View asyncToReact.js
function asyncToReact(fn) {
class PromiseComponent extends React.Component {
state = { waiting: true, result: null };
componentDidMount() {
fn(...this.props.args).then(result => this.setState({ waiting: false, result }));
}
componentDidUpdate() {
fn(...this.props.args).then(result => this.setState({ waiting: false, result }));
}
shouldComponentUpdate(newProps) {
@jaredwilli
jaredwilli / Enhance.js
Created Nov 24, 2017 — forked from sebmarkbage/Enhance.js
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
View .bash_profile
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Add yarn to PATH
export PATH="$PATH:/opt/yarn-[version]/bin"
View .aliases
#!/usr/bin/env bash
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
@jaredwilli
jaredwilli / coverage.js
Created Nov 10, 2017 — forked from paulirish/coverage.js
JS coverage profiler data via protocol
View coverage.js
'use strict';
const chromeLauncher = require('chrome-launcher');
const CDP = require('chrome-remote-interface');
const launchChrome = () =>
chromeLauncher.launch({
chromeFlags: ['--disable-gpu', '--headless']
});
View context-lifecycle-arguments.js
componentWillReceiveProps( nextProps, nextContext)
shouldComponentUpdate(nextProps,nextState,nextContext)
componentWillUpdate(nextProps,nextState,nextContext)
componentDidUpdate(prevProps,prevState,prevContext)
@jaredwilli
jaredwilli / UnmaskPendoEmails.js
Last active Nov 8, 2017
Documentation for unmasking Pendo emails for Cloudlock NPS report
View UnmaskPendoEmails.js
/**
* Cloudlock NPS report email address unmasking.
*
* Original DevTools snippet is here:
* https://gist.github.com/jaredwilli/013a74dbdd6d630a254ee1a12f08c2c8
*
* I have the above script saved as a DevTools snippet. For info on how to do that check this out:
* https://developers.google.com/web/tools/chrome-devtools/snippets
*
*
@jaredwilli
jaredwilli / unmaskPendoEmails.js
Last active Nov 8, 2017
Unmask Pendo email addresses for Cloudlock NPS report CSV
View unmaskPendoEmails.js
// use comma delimiter tool
// https://delim.co/#
// After setting an array var a; with the array of user emails run this script to unmask
// the emails, console.log them and automatically copy them to clipboard.
var r = [];
for (var i = 0; i < a.length; i++) {
var email = a[i].split('user-')[1];
r.push(window.atob(email.split('@')[0]));
}
@jaredwilli
jaredwilli / settings.json
Last active Nov 7, 2017
Old Mac VSCode User Settings
View settings.json
{
"debug.allowBreakpointsEverywhere": true,
"debug.inlineValues": true,
"files.autoSave": "onFocusChange",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"editor.cursorStyle": "line-thin",
"editor.wordWrap": "on",
You can’t perform that action at this time.