Skip to content

Instantly share code, notes, and snippets.

View robotlolita's full-sized avatar
🐴
everything happens so much oh no

Quil robotlolita

🐴
everything happens so much oh no
View GitHub Profile
@robotlolita
robotlolita / minimalist-classes.js
Created November 2, 2011 01:50 — forked from BrendanEich/minimalist-classes.js
less minimalism, richer leather
// A response to jashkenas's fine proposal for minimalist JavaScript classes.
// Harmony always stipulated classes as sugar, so indeed we are keeping current
// JavaScript prototype semantics, and classes would only add a syntactic form
// that can desugar to ES5. This is mostly the same assumption that Jeremy
// chose, but I've stipulated ES5.
// Where I part company is on reusing the object literal. It is not the syntax
// most classy programmers expect, coming from other languages. It has annoying
// and alien overhead, namely colons and commas. For JS community members who
// create an array of terms from an array of objects
for item in trend.search_terms
search_terms.push(item.term)
// while a part of the array is left
while search_terms.length > 0
// create a mini array of 7 items
for num in [0..7]
@robotlolita
robotlolita / about.md
Created August 10, 2011 16:50 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@robotlolita
robotlolita / gist:1126695
Created August 5, 2011 00:53 — forked from jido/gist:1126681
How JS scoping messes with capture
var a = {};
a.foo = function() {
return "foo";
}
a.bar = function() {
return "bar";
}
// put inside a .js file, referenced on the page by the resource's URI
// Create a local variable to hold `jQuery', so you type less.
// Using $ is stupíd, since that symbol is (by ES5 specs) reserved for
// machine-generated code.
void function(j) {
function get_data() {
// use functions to abstract code sections
function get_item(i) { return data[i].high + '<br>' + ~~(Math.random() * 111) }
function update(idx) { return j('#high').html(get_item(idx)) }
function process(data){ return j.each(data, update) }
var http = require('http');
var fs = require('fs');
var url = require('url');
var settingsPath='settings2.json';
var Server = function(path){
this.readSettings(path);
}
var sDate = new Date()
, today = new Date()
, str = ""
, node;
sDate.setFullYear(2011, 0, 1);
if (sDate > today) {
str = sDate.getFullYear() }
else {