This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getName = function() { | |
console.log("Name is: " + this.name); | |
}; | |
console.log(getName()); // Undefined | |
var jos = { name : 'Jos' }; | |
jos.getName = getName; | |
console.log(jos.getName()); // Name is Jos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jos = { name : 'Jos' }; | |
jos.getFullName = function(surname) { | |
var that = this; | |
var printName = function(surname){ | |
console.log("Full name", this.name + ' ' + this.surname); | |
console.log("Full name", that.name + ' ' + surname); | |
} | |
printName('Parker'); | |
} | |
jos.getFullName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Car = function(colour) { | |
this.colour = colour; | |
}; | |
var redCar = new Car("Red"); | |
var yellowCar = new Car("Yellow"); | |
Car.prototype.getColour = function(){ | |
return this.colour; | |
}; | |
console.log(redCar.getColour()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
________ | |
.##@@&&&@@##. | |
,##@&::%&&%%::&@##. | |
#@&:%%000000000%%:&@# | |
#@&:%00' '00%:&@# | |
#@&:%0' '0%:&@# | |
. . . . #@&:%0 0%:&@# | |
,`,`,`,`, #@&:%0 0%:&@# | |
. . . . `\`\`\`\; #@&:%0 0%:&@# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var util = require('util'); | |
var http = require('http'); | |
// index.html | |
var html = [ | |
'<html><head><script src="/socket.io/socket.io.js"></script>', | |
'<script>', | |
'var socket = io.connect(document.location.href);', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#header { | |
display : none; | |
} | |
form li.focused { | |
background : none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.nav-tabs.compact > li > a { | |
font-size: 0.9em; | |
padding: 4px 5px; | |
margin-right: 4px; | |
line-height: 16px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
exports.latlong = function(params, cb) { | |
var url, | |
address = params.address, | |
data = ''; | |
url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' + | |
address + '&sensor=false'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var letItSnow = function(){ | |
return setInterval(function(){ | |
var snow = document.createElement('div'); | |
snow.innerHTML = '*'; | |
snow.style.cssText = 'position:absolute; color: #ddd; font-size: 22px; top: ' + Math.random()*window.innerHeight + 'px; right: ' + Math.random()*window.innerWidth + 'px'; | |
document.body.appendChild(snow) | |
}, 100); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mbaas = require('fh-mbaas-express'); | |
var express = require('express'); | |
// Securable endpoints: list the endpoints which you want to make securable here | |
var securableEndpoints = ['hello']; | |
var app = express(); | |
// Note: the order which we add middleware to Express here is important! | |
app.use('/sys', mbaas.sys(securableEndpoints)); |