Skip to content

Instantly share code, notes, and snippets.

View csanz's full-sized avatar
🎯
Focusing

Christian Sanz csanz

🎯
Focusing
View GitHub Profile
@csanz
csanz / server.js
Created July 13, 2011 22:40
Pushing Sessions to Redis w/ Nodejs and Express
/* See instructions below */
var express = require('express')
, RedisStore = require('connect-redis')(express);
var app = express.createServer();
app.configure(function(){
this
.use(express.cookieParser())
@csanz
csanz / must_have_sublime_settings.json
Created July 16, 2011 05:47
Must Have Sublime Text 2 Setting
// Change inside File Global Settings
{
tab_size: 2
, translate_tabs_to_spaces: true
}
/* http://www.sublimetext.com/docs/2/indentation.html */
Total 526 (delta 373), reused 526 (delta 373)
-----> Heroku receiving push
-----> Node.js app detected
-----> Vendoring node 0.4.7
-----> Installing dependencies with npm 1.0.8
> mongodb@0.9.6-7 install /tmp/build_1agwg1lk02y19/node_modules/mongoose/node_modules/mongodb
> bash ./install.sh
csanz$ npm install
> mongodb@0.9.6-7 install /Users/csanz/Projects/geeklist/www_staging/node_modules/mongoose/node_modules/mongodb
> bash ./install.sh
================================================================================
= =
= To install with C++ bson parser do <npm install mongodb --mongodb:native> =
= the parser only works for node 0.4.X or lower =
= =
@csanz
csanz / whyichosemac.md
Created July 31, 2011 18:32
Why I chose Mac OS X over Windows

So my brother sent me an email asking me why I chose Mac OS X over the Windows OS (PC)

email from my brother

With my federal loan I can buy a new laptop… I was wondering your opinion as coder and programmer. Why you changed to mac? Is it better? Would you say the same… or is it worthwhile for my Masters where I am going to have emphasis on computer science courses

my Response

it really doesn't matter, today you can pretty much do anything on a windows machine that you typically do on a mac via virtual machines. me choosing a mac was more of a personal preference. I forced myself to try it out (geek thing) and ended up loving it... but I have to admit, going from windows to mac wasn't easy at first because I had to learn a lot (the first week). <<< I transitioned 5 years ago

@csanz
csanz / lost_photos_from_germany.md
Created July 31, 2011 19:16
Lost photos from Germany

Lost photos from Germany

These color pictures were taken by a Life photographer between 1939 and 1940 in Berlin and were lost for over 70 years because the American photographer disappeared at the beginning of the war, along with his Roliflex camera.

[ Download PDF Here ] (http://f.cl.ly/items/0L092h0w2g0j3R0D3k1n/Germany_1939-40.pdf)

Summary

@csanz
csanz / using_repl.md
Created August 1, 2011 09:07
Debugging your Mongoose Models Using Repl

Debugging your Mongoose Models Using Repl

This is a faster way to test your mongoose models. The example below was based on the expressjs-blog example here

Example

$node
> var mongoose = require('mongoose')
> var db = mongoose.connect('mongodb://localhost/blogsample')

> db.model('BlogPost', require('./app/models/blogpost'))

Non-authoritative answer:
fastdl.mongodb.org canonical name = d3mw3wlkjdkqc9.cloudfront.net.
Name: d3mw3wlkjdkqc9.cloudfront.net
Address: 216.137.37.45
Name: d3mw3wlkjdkqc9.cloudfront.net
Address: 216.137.37.130
Name: d3mw3wlkjdkqc9.cloudfront.net
Address: 216.137.37.188
Name: d3mw3wlkjdkqc9.cloudfront.net
Address: 216.137.37.66
@csanz
csanz / randomizer.js
Created August 8, 2011 19:33
Mongodb Randomizer Script
db.users.find().forEach(function(user) {
db.users.update({_id: user._id}, { $set: { random: Math.random() }});
});
// Runs in less than 1 sec for 2k records
db.users.ensureIndex({random:1});
/*
@csanz
csanz / lalalala.js
Created August 8, 2011 19:37
Geeklist Home Screen Randomizer
db.users.find().forEach(function(user) {
if(user.company){
db.users.update({_id: user._id}, { $set: { random: Math.random(), is_featured: true }});
}else{
db.users.update({_id: user._id}, { $set: { is_featured: false }});
}
});
db.users.find({is_featured: true},{screen_name:1}).limit(10).sort({random: 1})