Skip to content

Instantly share code, notes, and snippets.

View twhite96's full-sized avatar
☢️
Cookin

tiff twhite96

☢️
Cookin
View GitHub Profile
@twhite96
twhite96 / 👀.md
Created June 3, 2017 22:19 — forked from notwaldorf/👀.md
Advice for new developers

Someone sent me an email asking me what advice I had for new developers. I get this question a bunch, so I wanted to put all my thoughts in one place, that I can update as I get more ideas!

I answered this a bunch on my AMA repo, so here's some initial general answers, before I get to some of the specific questions:

@twhite96
twhite96 / array_iteration_thoughts.md
Created June 4, 2017 23:18 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@twhite96
twhite96 / example01.js
Created August 15, 2017 06:28 — forked from mpj/example01.js
Code for the async/await episode of Fun Fun Function.
const response = await fetch(`https://catappapi.herokuapp.com/users/${userId}`)
const data = await response.json()
return data.imageUrl
}
@twhite96
twhite96 / emoji.js
Created September 12, 2017 02:51 — forked from minamarkham/emoji.js
Add emojis to URL
function emoji() {
if (navigator.userAgent.indexOf('Mac OS X') != -1) {
window.location.hash = "💋";
}
};
emoji();
// only works on Macs 😞
@twhite96
twhite96 / gulpfile.js
Created November 13, 2017 04:59 — forked from supalogix/gulpfile.js
A gulp file for our demo project
var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
var typescript = require('gulp-tsc');
var runSequence = require('run-sequence');
gulp.task('compile', function(){
return gulp.src(['src/ts/**/*.ts'])
.pipe(typescript())
.pipe(gulp.dest('src/js/'));
});
@twhite96
twhite96 / switch-to-rbenv.md
Created November 19, 2017 01:59 — forked from traumverloren/switch-to-rbenv.md
Switch from RVM to rbenv

Switch from RVM to rbenv:

Get Rid of RVM if it's installed:

rvm implode

Cleanup your .bash_profile/.bashrc/.zshrc file to remove RVM from the path:

You should have something like this left from RVM. Delete it from the file. ``[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"```

@twhite96
twhite96 / organize-photos.py
Created February 2, 2018 00:06 — forked from cliss/organize-photos.py
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@twhite96
twhite96 / gist:53f7ac297a561d74871d394146db4e7f
Created February 27, 2018 02:39 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@twhite96
twhite96 / README.md
Created February 27, 2018 23:05 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@twhite96
twhite96 / nokogiri_install
Created March 21, 2018 01:38 — forked from sobstel/nokogiri_install
nokogiri -> ERROR: cannot discover where libxml2 is located on your system
# `ERROR: Error installing nokogiri:
# ERROR: Failed to build gem native extension.
#
# current directory: /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.7.0/ext/nokogiri
# /usr/local/var/rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170103-68488-r71c9j.rb extconf.rb --with-xml=/usr/local/Cellar/libxml2/ --use-system-libraries
# checking if the C compiler accepts ... yes
# checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
# Building nokogiri using system libraries.
# ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
# *** extconf.rb failed ***