Skip to content

Instantly share code, notes, and snippets.

View tsongas's full-sized avatar

Chris Tsongas tsongas

  • Vercel
  • Seattle
  • 01:59 (UTC -07:00)
  • LinkedIn in/tsongas
View GitHub Profile
var Abc = function(aProperty,bProperty){
this.aProperty = aProperty;
this.bProperty = bProperty;
this.init = function(){
// Do things here.
}
this.init();
};
var currentAbc = new Abc(obj,obj);
var chai = require('chai');
var chaiHttp = require('chai-http');
var server = require('../server.js');
var should = chai.should();
var app = server.app;
var storage = server.storage;
chai.use(chaiHttp);
@tsongas
tsongas / f1-class-7-links.md
Last active August 29, 2015 14:17
Links for Class 7
sdjfa;lskdjf ;laksjdf ;lksdf
@tsongas
tsongas / gist:a390b2a8cb4d8ac2857c
Created March 2, 2015 18:21
SSJS Vulnerability
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
if (req.method === 'GET') {
res.end('Waiting for data....');
}
if (req.method === 'POST') {
res.write('Receiving data....');
@tsongas
tsongas / gist:dbf5fdc1f0c179eafe2c
Created February 17, 2015 18:49
prototype vs __proto__
__proto__ is the actual object that is used in the lookup chain to resolve methods. It is a property that all objects have. This is the property which is used by the JavaScript engine for inheritance. According to ECMA specifications it is supposed to be an internal property, however most vendors allow it to be accessed and modified.
prototype
prototype is a property belonging only to functions. It is used to build __proto__ when the function happens to be used as a constructor with the new keyword
http://stackoverflow.com/questions/9959727/proto-vs-prototype-in-javascript
http://webstuff.leods92.com/post/25392435543/javascript-prototype-vs-proto
http://www.quora.com/What-is-the-difference-between-__proto__-and-prototype
http://dailyjs.com/2012/11/26/js101-proto/
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var Cat = mongoose.model('Cat', { name: String });
var kitty = new Cat({ name: 'Zildjian' });
kitty.save(function (err) {
if (err) // ...
console.log('meow');
});
mkdir data
echo 'mongod --dbpath=data --nojournal --rest "$@"' > mongod
chmod a+x mongod