Skip to content

Instantly share code, notes, and snippets.

💻
Close 2nd to surfin'

Jeff Wainwright yowainwright

💻
Close 2nd to surfin'
Block or report user

Report or block yowainwright

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
@getify
getify / 1.js
Last active Apr 11, 2019
tag function for formatting console.log(..) statements
View 1.js
function logger(strings,...values) {
var str = "";
for (let i = 0; i < strings.length; i++) {
if (i > 0) {
if (values[i-1] && typeof values[i-1] == "object") {
if (values[i-1] instanceof Error) {
if (values[i-1].stack) {
str += values[i-1].stack;
continue;
}
View api-cheatsheet-array.md

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
@rodneyrehm
rodneyrehm / polyfill-intl.js
Created Aug 21, 2017
Webpack: load Intl polyfill with languages
View polyfill-intl.js
const needsPolyfill = !window.Intl
/* eslint-disable import/no-webpack-loader-syntax */
const intl = require('bundle-loader?lazy&name=intl!intl')
/* eslint-enable import/no-webpack-loader-syntax */
const polyfilled = needsPolyfill && new Promise(resolve => {
intl(resolve)
})
View update-repos.sh
#!/bin/bash -
#===============================================================================
# FILE: repos.sh
#
# USAGE: Update all the git repos in your ~/code directory. This will
# skip over "dirty" (code changed and uncommited) repos and
# give a warning and, after completion, list those repos.
#
# The script will ask if you want to npm install or npm build
# in the frontend repos, default is "n" (no).
@int128
int128 / README.md
Last active Sep 20, 2019
Watching build mode on Create React App
View README.md

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

@robdodson
robdodson / index.html
Last active Sep 6, 2019
Shady DOM example
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h2>Hello from outside the Shadow DOM!</h2>
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active Nov 7, 2019
Install MySQL on Sierra using Homebrew
View MySQL_macOS_Sierra.md

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@briangonzalez
briangonzalez / dark-title-bar.sh
Last active Sep 8, 2016
Atom - Dark Title Bar
View dark-title-bar.sh
# A prettier Atom via PR #10208.
# https://github.com/atom/atom/pull/10208
# Quit then remove.
osascript -e 'quit app "Atom"'
rm -rf /Applications/Atom.app
# Install, build, then open.
git clone -b pb-hidden-inset-1.8 git@github.com:briangonzalez/atom.git
cd atom
View reduxSelectorPattern.md

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default:
View xpath-cheatsheet.js
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
You can’t perform that action at this time.