Skip to content

Instantly share code, notes, and snippets.

View don-smith's full-sized avatar
🧘

Don Smith don-smith

🧘
  • HYPR
  • Tākaka, NZ
View GitHub Profile
@don-smith
don-smith / bar.js
Last active October 17, 2015 05:50
A few examples of exporting and importing ES6 modules
export function gar() {
console.log('bar.gar');
}
export function zar() {
console.log('bar.zar');
}
function hidden() {
console.log('no see me');
@don-smith
don-smith / generators.md
Created October 24, 2015 20:14 — forked from learncodeacademy/generators.md
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);

Keybase proof

I hereby claim:

  • I am don-smith on github.
  • I am dons (https://keybase.io/dons) on keybase.
  • I have a public key ASBbQQXmwXqah0-QLLYij98BHENiGa4jSp5R3RTR11eKPAo

To claim this, I am signing this object:

@don-smith
don-smith / mac-setup.md
Created May 12, 2016 22:35
How I treat each new Mac I appropriate

My OS X Setup Guide

Config

  • Adjust trackpad settings to my liking (Preferences > Trackpad)
  • Remap caps-lock to control (Preferences > Keyboard > Modifier Keys... button)

Install

@don-smith
don-smith / hippy.zsh-theme
Last active August 29, 2016 08:44
A thoughtful ZSH theme
# ZSH Theme inspired by the bira theme
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='☮ %{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
else
local user_host='☯'
fi

Code review feedback

  • Rename firebaseInit.js to api/index.js or something similar that is not tied to a technology.

    • This will let you export each function from its own file (imported into index.js)
    • Import library code (firebase, ramda) before your code (dbInit)
    • Remove commented out code
  • If we're not using Firebase UI, we should remove the config in dbInit.

@don-smith
don-smith / linux-setup.md
Last active August 24, 2016 05:11
How I treat each new Linux box I appropriate

My Debian Setup Guide

Config

  • su
  • adduser sudo don
  • Log out and back in

Install

@don-smith
don-smith / coffee.js
Created September 18, 2016 03:14
Some code for an EDA advertisement. It has been superimposed onto the foam of a latte.
#!/usr/bin/env node
const ids = [4, 9, 1],
o = 'caffeine drink',
e = (r='', n=0) => ids[n] ?
e(r + o[ids[n]], ++n) : r
console.info(e())
// constructor function implementation
function Test (args) {
// explicit internal state without using `this`
const state = {
op: args.op,
missing: args.missing
}
return { // explicit return
// explicit binding of function
// parameters with internal state
@don-smith
don-smith / github.sh
Last active December 1, 2016 09:01
Allows multiple GitHub users to use the same computers using individual SSH keys
#!/bin/sh
# This script creates an SSH key for use on GitHub
# Step 1: Copy and paste this github() function into the ~/.zshrc file
github() {
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/$1
email=`cat ~/.ssh/$1.email`
git config --global user.name $1