Skip to content

Instantly share code, notes, and snippets.

@user512
user512 / shortest.md
Last active September 12, 2015 18:58
shortest question 6
square_of_sum = (1..100).reduce(:+) ** 2

sum_of_square = (1..100).inject {|sum, n| sum + n ** 2}

p square_of_sum - sum_of_square
@user512
user512 / twitter-gem-cheat-sheet.md
Last active September 14, 2015 02:43
Twitter Gem cheat sheet
@user512
user512 / finalProjectWireframe.md
Last active August 27, 2015 23:19
DBC Final Project Wireframe

Meteor.js

Cheatsheet for Meteor.js beginner

To install Meteor on OS X or Linux
curl https://install.meteor.com/ | sh
To create project
@user512
user512 / markdown.md
Last active August 29, 2015 14:27
markdown.md

###This is H3

def method(arg)

arg
end

Javascript Lecture

Closure

function(thisOtherNumber){
  return numberToAdd + theOtherNumber;  
}

That function remembers variables numberToAdd that were around when the function was declared.

Handlebars
- Clinet side JS templating engine
- JS library included in the HTML page
- Allows adding templates to your HTML page
Reason to use a JS tempting engine
- fast, on clinet side
- easier to read with a lot of string interpolation.
When to use JS tempting engine
OOJS
CRUD
AJAX
prototype in js?
not expected to write test
$("a").click(function(e) {
e.preventDefault(); // prevent default action
$.ajax{
url: $(this).attr("href"),
dataType
}).done(function(data) { // ajax call
})
})
@user512
user512 / oojs.md
Last active August 29, 2015 14:26 — forked from stujo/oojs.md
Object Oriented JavaScript

#Object Oriented Javascript

#Overview

  • Creating Objects in JavaScript
    • new Object();
    • Object Literal Notation (Important)
    • Factory Function
  • Review JavaScript's this
  • More Creating Objects in JavaScript
  • Constructor Function