Skip to content

Instantly share code, notes, and snippets.

guiomie

Block or report user

Report or block guiomie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@guiomie
guiomie / gist:1046775
Created Jun 25, 2011
Function parameters not passed
View gist:1046775
var writeToCollection = function(collectionName, jsonObject){
try{
//the db name is hardcoded,
var collection = new mongo.Collection(db, collectionName);
collection.insert(jsonObject, {safe:true}, function(err, objects) {
if(err != null){
sys.log("Could not write JSON in collection ->" + err);
@guiomie
guiomie / gist:1167029
Created Aug 24, 2011
Saving new user, put it always saves the same thing in mongodb (first authenticated user) I'm using everyauth
View gist:1167029
exports.findOrCreateFacebookUser = function(fbUserData, promise){
User.findOne({_id:fbUserData.id}, function(err, user) {
if(err) {
console.log("Error in finding user for auth. Check Db");
promise.fail(err);
return;
}
else if(user){
console.log("User found ");
@guiomie
guiomie / express static weird
Created Sep 21, 2011
Serves an invisible image, but a css file without any issues.
View express static weird
var express = require("express"),
app = express.createServer();
app.use(express.static(__dirname + '/static'));
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(process.env.C9_PORT);
@guiomie
guiomie / gist:1258099
Created Oct 2, 2011
Calling getParcourList returns undefined all the time
View gist:1258099
var getParcourList = function(userId){
GeneralReference.findOne({ id: userId}, function(err, result){
if(err){
console.log("error in save: " + err);
return "No Document found: " + err;
}else{
//console.log(JSON.strinresult.parcours);
return result.parcours;
@guiomie
guiomie / node-service-deploy on joyent smartmachine
Created Oct 23, 2011
node-service-deploy on joyent smartmachine
View node-service-deploy on joyent smartmachine
[node@workoutcell ~]$ node-service-deploy
Deploying node-service.
revision: master
timestamp: 2011-10-23T15-38-27.419110651
Installing node module deps (from package.json).
npm WARN invalid config node-version="v0.4"
> mongoose@2.3.6 test /home/node/node-service/releases/2011-10-23T15-38-27.41911 0651/node_modules/mongoose
> make test
@guiomie
guiomie / gist:1307532
Created Oct 23, 2011
npm config ls on joyenr smartmachine
View gist:1307532
; userconfig /home/node/.npmrc
link = true
prefix = "/home/node/local"
tmp = "/home/node/.tmp"
; node install prefix = /opt/nodejs/v0.4
; node bin location = /opt/nodejs/v0.4/bin/node
; cwd = /home/node/node-service/releases/2011-10-23T15-38-27.419110651/node_modules/mongoose/node_modules/mongodb
; HOME = /home/node
; 'npm config ls -l' to show all defaults.
@guiomie
guiomie / gist:1307544
Created Oct 23, 2011
node-service-deploy with all modules npm uninstalled -g
View gist:1307544
Deploying node-service.
revision: master
timestamp: 2011-10-23T16-16-54.342441619
Installing node module deps (from package.json).
npm WARN invalid config node-version="v0.4"
> express@2.4.7 test /home/node/node-service/releases/2011-10-23T16-16-54.342441619/node_modules/express
> make test
@guiomie
guiomie / gist:1307728
Created Oct 23, 2011
Is this an invalid package.json ?
View gist:1307728
{ "name": "test",
"version": "0.1.3",
"dependencies":
{
"express": "2.4.7",
"everyauth": "0.2.23",
"mongoose": "2.3.6"
}
}
@guiomie
guiomie / gist:1307787
Created Oct 23, 2011
smartmachine deploy erro
View gist:1307787
Counting objects: 10, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 685 bytes, done.
Total 6 (delta 4), reused 0 (delta 0)
remote: Deploying node-service.
remote: revision: 3b1dbf806500f56d5954010bcc559b02266c11bc
remote: timestamp: 2011-10-23T19-36-49.040696340
remote: Installing node module deps (from package.json).
@guiomie
guiomie / gist:1352079
Created Nov 9, 2011
Save in Mongoose has unexpected behavior
View gist:1352079
var saveEvent = function(eventObject, userId, ref, callback){
var theEvent = new CalendarEvent();
theEvent.title = eventObject.title;
theEvent.allDay = eventObject.allDay;
theEvent.start = eventObject.start;
theEvent.end = eventObject.end;
theEvent.url = "empty";
theEvent.color = eventObject.color;
You can’t perform that action at this time.