Skip to content

Instantly share code, notes, and snippets.

View ivanoats's full-sized avatar
💭
🤙 Stoked 🏄‍♂️

Ivan Storck ivanoats

💭
🤙 Stoked 🏄‍♂️
View GitHub Profile
@ivanoats
ivanoats / promise.js
Created February 20, 2014 23:45 — forked from dhable/promise.js
function promise() {
var listeners = [],
resolved = false,
data;
return {
isResolved: function() {
return resolved;
},
@ivanoats
ivanoats / 0_reuse_code.js
Created February 23, 2014 19:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
var Point = function (xloc,yloc) {
var x = xloc;
var y = yloc;
var constructor = function(){ }
constructor.prototype.getX = function() { return x; }
constructor.prototype.getY = function() { return y; }
constructor.prototype.translate = function(xdelta,ydelta) {
x = x + xdelta;
y = y + ydelta;
}

Node.js is the red-hot new hotness! You can't throw a stick on the internet without hitting someone talking about Node. But why? For one, it's built on JavaScript which is completely ubiquitous. So, why not build a development stack and server on JavaScript? I would argue that the installation is almost painless while the terseness of the language is not.

While you can create apps 100% from Node.js, the Express framework is a great tool that helps you solve many standard problems without having to write boilerplate code.

Node.js is here and it's not going anywhere anytime soon. So if you are new to Node.js, Express, and even JavaScript in general, this is a great newb's step-by-step guide to get started.

Get Node Installed

There are a handful of ways you can install Node into your system ranging from a pre-packaged installer to source. Somewhere in here you will find a way that works best for you.

/*****************
* cellBlockA.js *
*****************
*
* Good morning, Dr. Eval.
*
* It wasn't easy, but I've managed to get your computer down
* to you. This system might be unfamiliar, but the underlying
* code is still JavaScript. Just like we predicted.
*
/********************
* theLongWayOut.js *
********************
*
* Well, it looks like they're on to us. The path isn't as
* clear as I thought it'd be. But no matter - four clever
* characters should be enough to erase all their tricks.
*/
function startLevel(map) {
@ivanoats
ivanoats / Caskfile
Created April 24, 2014 20:41 — forked from gnufied/Caskfile
(source "melpa" "http://melpa.milkbox.net/packages/")
(source "gnu" "http://elpa.gnu.org/packages/")
(source "marmalade" "http://marmalade-repo.org/packages/")
(depends-on "ac-js2")
(depends-on "adaptive-wrap")
(depends-on "ag")
(depends-on "auto-complete")
(depends-on "calfw")
(depends-on "cask")
'use strict';
var parenFinder = function (){
var parens = [];
var expression = process.argv[2];
var isOK = true;
for(var i = 0; i < expression.length; i++){
if (expression[i] === '('){
parens.push(i);
}
if (expression[i] === ')'){
@ivanoats
ivanoats / install_node.md
Last active August 29, 2015 14:04 — forked from toastynerd/gist:e1c9df76cb71a0a007d3
Installing Node from source
  • goto the node website
  • click download
  • click the source download
  • go to the directory you downloaded the source to
tar -xzvf <the node tar.gz you downloaded>
cd <node directory>
./configure --prefix=~/.node
make &amp;&amp; make install
//var reverse = require('../app/reverse');
var pal = require('../app/pal');
var expect = require('chai').expect;
describe('palindrome', function() {
it('it is a palindrome', function() {
expect(pal('racecar')).to.be.true;
});
});