Skip to content

Instantly share code, notes, and snippets.

View jasonrhodes's full-sized avatar

Jason Rhodes jasonrhodes

View GitHub Profile
@jasonrhodes
jasonrhodes / curry-and-nan.js
Created July 29, 2014 15:21
Curry and NaN
function masala(divisor) {
return function (dividend) {
return dividend / divisor;
};
}
var naan = masala(0);
@jasonrhodes
jasonrhodes / started-bottom-links.md
Last active August 29, 2015 14:04
Links etc from my "Started from the Bottom" talk at Cascadia JS 2014
@jasonrhodes
jasonrhodes / revisit-quickstart-for-beginners.md
Last active August 29, 2015 14:05
Intro to node: notes about the revisit.link-quickstart guide and how to improve for beginners
  • What is "npm install?" how do i download node/npm?
  • "run" npm install -- from where? terminal / cli / prompt
  • quick explanation of what a package manager is, package.json
  • do you really need to make a new repo right away? if so explain that it should be named uniquely for you
@jasonrhodes
jasonrhodes / post-receive.sh
Created September 6, 2014 18:13
My git post-receive hook for Digital Ocean -- I make a bare repo in /var/repos/{reponame}/app.git and then add this code to the post-receive hook in app.git/hooks then set up a remote via ssh to the app.git folder
#!/bin/sh
# Store git files in a different directory than the repo
git --work-tree=/var/www/meatspace-markov-memeify --git-dir=/var/repos/meatspace-markov-memeify/app.git checkout -f
# Install npm deps
cd /var/www/meatspace-markov-memeify && npm install
# If index.js is running, restart--otherwise start!
forever restart --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/index.js --port=8000 || forever start --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/index.js --port=8000
@jasonrhodes
jasonrhodes / js-concepts.md
Last active August 29, 2015 14:06
JS core concepts, useful for brushing up before interviews, etc.

Event delegation

DOM events bubble up through the DOM tree and register against every element up to the top. The object passed to the listener (call it e for example) will have the e.target property, which was the element that was interacted with directly ("clicked", etc.) and the e.currentTarget property, which is the element that was listening when this event listener caught the event.

e.stopPropagation() will keep the event from continuing to bubble up the DOM tree.


this

@jasonrhodes
jasonrhodes / bmns_9-2014_itinerary.md
Last active August 29, 2015 14:06
meeting itinerary etc for 9/27 baltimore nodeschool event
  • Mentors arrive early for set up
  • Setup checklist:
    • tables/chairs
    • snacks
    • registration
    • feedback stations?
  • Attendees arrive, music on, welcome slide up
  • Registration checklist:
    • Check off name
  • Verify email address, highlight?
@jasonrhodes
jasonrhodes / nodeschool-install.md
Last active August 29, 2015 14:06
nodeschool installations

You will need:

A GitHub account

If you don't have an account, get a free one at http://github.com (it's not NECESSARY but we're going to use it for discussions and making the coursework better!)

Node.js

Go to http://nodejs.org and follow the installation instructions, usually just clicking the big Install button.

@jasonrhodes
jasonrhodes / index.js
Last active August 29, 2015 14:07
requirebin sketch
console.clear();
var twitter = require('twitter-text');
var linked = [];
var body = document.body;
linked.push(twitter.autoLink("http://www.monoprice.com/Product?c_id=108&cp_id=10828&cs_id=1082806&p_id=9744&seq=1&format=2"));
linked.push(twitter.autoLink("http://google.com"));
@jasonrhodes
jasonrhodes / index.js
Last active August 29, 2015 14:07
requirebin sketch
var twitter = require('twitter-text');
var linked = [];
var linkify = function (text, options) {
var entities = twitter.extractEntitiesWithIndices(text, { extractUrlsWithoutProtocol: true });
return twitter.autoLinkEntities(text, entities, options);
};
linked.push(linkify("http://www.monoprice.com/Product?c_id=108&cp_id=10828&cs_id=1082806&p_id=9744&seq=1&format=2"));
@jasonrhodes
jasonrhodes / gutpunch.sh
Created October 16, 2014 20:03
Because sometimes `gut punch origin master` is more accurate
# In ~/.bash_profile or ~/.profile, whichever you use
alias gut="git"
# In ~/.gitconfig
[alias]
punch = push
# Or maybe more acccurately
[alias]
punch = push -f