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 / gitprotips.md
Created September 8, 2011 02:35
Git Pro Tips

Rebasing

The idea here is that you want to keep your branch super fresh with the latest updates... (some use master, others create a new branch called dev or staging)

  git checkout master && git pull origin master
  git checkout branch-name
  git rebase master
  git push origin :branch-name
  git push origin branch-name
@csanz
csanz / geekli.st.md
Created September 1, 2011 23:53
Commit Stats

Geekli.st repo summary

  project: www
     commits: 449
     files  : 771
     authors: 
       234	Christian Sanz          52.1%
        74	Tim Smart               16.5%
        57	arlolra                 12.7%

30 rekatz 6.7%

@csanz
csanz / encrypt_decrypt.js
Created August 30, 2011 16:06
Simple String Encryption & Decryption with Node.js
function encrypt(text){
var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq')
var crypted = cipher.update(text,'utf8','hex')
crypted += cipher.final('hex');
return crypted;
}
function decrypt(text){
var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq')
var dec = decipher.update(text,'hex','utf8')
@csanz
csanz / movingredistolinode.md
Created August 29, 2011 07:40
Moving your redis instance to linode

Move your redis instance to Linode!

create linode server instance

local:

<shell>$ssh root@(IP ADDRESS)

remote:

telnet filefish.redistogo.com 9576
Trying 75.101.153.205...
telnet: connect to address 75.101.153.205: Connection refused
telnet: Unable to connect to remote host
@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})
@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});
/*
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 / 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'))

@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