Skip to content

Instantly share code, notes, and snippets.

View stevepentler's full-sized avatar

Steve Pentler stevepentler

View GitHub Profile
What is ES6?
  • ECMAScript 6 is the gin and juice of 2015.
  • installation: $ gem install sprockets-es6
  • Gemfile

  • gem "sprockets"
  • gem "sprockets-es6"
  • require "sprockets/es6"
What is Transpilation and how does it relate to ES6?
if you need to add upstream
- git remote -v to check
- git remote (add) upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPO.git => sets remote to upstream repo(ex: ruby submissions)
- git fetch upstream
- git checkout master
- git pull upstream master
- git merge upstream master
- git remote -v should be original

#####In the context of Node, what is a module?

  • modules are self-contained chunks of code that serve a specific purpose
  • equivalent to a Ruby class
  • module.exports is anything that is exposed from one file to another. It can be a constructor, function, variable, etc.

#####The code examples from the second blog post look very different from the first. Why?

  • the second article uses RequireJS, which loads asynchronously and packages the module in a define/require function.
  • in the example, they return variables/methods within the define function. This define method seems to wrap everything, but only the pieces that are exported are returned.
  • can pass other module dependencies into the define function ex: define(["models/Person", "my/utils"]), function (Person, utils) {...}
  • require is used when the dependencies are loaded immediately

JavaScript Functions

I can explain the difference between function declarations and function expressions.

  • Declarations are hoisted to top priority, whereas function expressions are declared but not defined until that line is run.

I can explain what the value of this is in a normal function.

  • global object

Step One: Watch Mary Rose Cook Live Codes Space Invaders from Front-Trends. (The second worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: What is one approach you can take from this Mary's code and implement in your project?

  • I watched the video a few days ago, but it was crucial to undestanding collision detection.

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.

@stevepentler
stevepentler / testable-js.markdown
Last active April 6, 2016 04:57 — forked from rrgayhart/testable-js.markdown
Writing Testable JavaScript

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded).

  • Did any of the responsibilities that she lists surprise you?
    • Presentation & interaction
    • Data/server communication
  • application state
@stevepentler
stevepentler / p5-integration.md
Last active April 7, 2016 17:27
One way to implement p5.js into a Node.js application

Want to implement p5.js into your Node application? This is one way to do it!

Process

  1. Download the p5 libraries. I recommend using the minified files due to the bulk of p5.

  2. Within the head of the index.html file, require each library. The individual files are stored with the libraries folder.

    <script type='text/javascript' src='./libraries/p5.min.js'></script>

    <script type='text/javascript' src='./libraries/p5.dom.js'></script>

###Pull Request

  • @jecrockett - refactor partner
  • @rrgayhart - instructor
  • @dastinnette - member of another refactor team, please review!

####What's this PR do? Abstracts draw object functionality into a canvasPainter object. This removes responsibilities from the generateFish function in the game class.

####Where should the reviewer start?

@stevepentler
stevepentler / express.markdown
Last active April 18, 2016 14:42 — forked from rrgayhart/express.markdown
Building Express Applications