Skip to content

Instantly share code, notes, and snippets.

View fernandoguedes's full-sized avatar
🤖

Luís Fernando Guedes fernandoguedes

🤖
View GitHub Profile
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@rponte
rponte / normalize.js
Created November 19, 2011 00:30
normalize.js
// Created by Nando Vieira
String.prototype.normalize = function() {
var from = "àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŕŕ";
var to = "aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr";
var value = this;
for(var i = 0; i < from.length; i++) {
char_re = new RegExp(from.charAt(i), "gim");
value = value.replace(char_re, to.charAt(i))
};
@bnoguchi
bnoguchi / enum-access.js
Created May 3, 2011 09:19
How to access enumValues in mongoose from a Model or Document
var mongoose = require('./index')
, TempSchema = new mongoose.Schema({
salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']}
});
var Temp = mongoose.model('Temp', TempSchema);
console.log(Temp.schema.path('salutation').enumValues);
var temp = new Temp();
console.log(temp.schema.path('salutation').enumValues);