Skip to content

Instantly share code, notes, and snippets.

@marcocerna
marcocerna / data.json
Last active September 25, 2015 23:31
Base for TVE
{
"resultList": [
{
"trioObject": {
"category": [
{
"categoryId": "tivo:ca.413855",
"label": "Reality",
@marcocerna
marcocerna / app.js
Created December 5, 2013 07:10 — forked from desa/app.js
var app = require('http').createServer(handler);
var io = require('socket.io').listen(app);
var fs = require('fs');
app.listen(8080);
function handler (req, res) {
fs.readFile(__dirname + '/index.html', function(err, data) {
if (err) {
res.writeHead(500);
@marcocerna
marcocerna / app.js
Created December 5, 2013 03:09 — forked from desa/app.js
var app = require('http').createServer(handler);
var io = require('socket.io').listen(app);
var fs = require('fs');
app.listen(8080);
function handler (req, res) {
fs.readFile(__dirname + '/index.html', function(err, data) {
if (err) {
res.writeHead(500);
###
# Node List
###
class Node
attr_accessor :val, :next
def initialize(val,next=nil)
@val=val
@next=next
end

Exercises/Lab for Linked Lists

1.) Write a function called last that finds the last node in the list.

2.) Write a function called count that gets the length of linked list. Don't use the #count method.

3.) Write a function called average that sums a linked list of numbers and divides it by the length.

4.) Write a function to reverse a linked list.

###
# Node List
###
class Node
attr_accessor :val, :next
def initialize(val, next_ref =nil)
@val=val
@next=next_ref
end
_ = require "lodash"
{Model, Collection} = require "backbone"
#Creating a simple todo collection
class Todo extends Model
defaults:
title: "",
completed: false
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD

Coffee-Script lab

Hater's lab

Objective
To reinforce skills familiar in javascript regarding DOM interaction, and successfully translate them into Coffee-Script.

Params

Quick Refresher

We were going to quickly discuss params

When you create a form in rails you should see something like the following

<form action="/somethings" method="post">