Skip to content

Instantly share code, notes, and snippets.

View tsongas's full-sized avatar

Chris Tsongas tsongas

  • Vercel
  • Seattle
  • 05:28 (UTC -07:00)
  • LinkedIn in/tsongas
View GitHub Profile
### What's the name (or codename) of your app?
Pindelible
### What will your app do?
Showcase black and white nude photography
### Who's on your team? What are their roles?
@tsongas
tsongas / race3.html
Created November 18, 2014 05:06
Rabbit Game Bar Graph
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Race 3</title>
<link rel="stylesheet" href="style3.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="script3.js"></script>
</head>
<body>
@tsongas
tsongas / script.js
Created November 20, 2014 05:10
Selection Sort Example
$(document).ready(function() {
var numbers = [];
console.log(numbers);
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
@tsongas
tsongas / crypto
Created February 10, 2015 18:12
Node.js crypto
var crypto = require('crypto');
crypto.randomBytes(24, function(err, buf) {
if (err) throw err;
var token = buf.toString('hex');
console.log(token);
});
mkdir data
echo 'mongod --dbpath=data --nojournal --rest "$@"' > mongod
chmod a+x mongod
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');
});
@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/
@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....');
sdjfa;lskdjf ;laksjdf ;lksdf