Skip to content

Instantly share code, notes, and snippets.

@samyakbhuta
samyakbhuta / gist:933863
Created April 21, 2011 06:34
First attempt for rap lyrics
Chorus : N P M , N P M, Everyboody say N P M,
Chorus : Pack it, Pack it, Just pack it !!
Solo : It handles dependencies,and we say it is divine !!
Solo : If you got no clue wh't hell it is, it's just fine !!
Chorus : N P M , N P M, Everyboody say N P M,
Chorus : Pack it, Pack it, Just pack it !!
-----
N P M is cool, for things it does for you !!
Noddy can't go without't, except the loo !!
@samyakbhuta
samyakbhuta / markdownSample.md
Created April 21, 2011 18:39
Mark down sample

Abc

Abc

###Abc### ##Abc## #Abc#

require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
var a = "123";
var b = function(){};
@samyakbhuta
samyakbhuta / userUtil.js
Created May 10, 2011 17:20
_id is nor set neither returned in .save function of Model
var mongoose = require('mongoose');
var myUserModel = require("./players").playerModel;
var util = require("util");
exports.insertUser = function (pn,di,ti){
var aUserInstance = new myUserModel();
aUserInstance.pn = pn;
aUserInstance.di = di;
aUserInstance.ti = ti;
aUserInstance.ls = +new Date();
/*
* Returns the next element in a function.
* Automatically rotates the index to the first element, if value matched the last element.
* If no match found for value returns the first element.
*/
var nextInArray = function (value,anArray){
//TODO : Check if anArray is really an array.
var index = anArray.indexOf(value);
if ( index == anArray.length-1 || index == -1 ) {
/*
* Returns a random element in a function.
*/
var randomInArray = function (anArray){
//TODO : Check if anArray is really an array.
var randomIndex=Math.floor(Math.random()*anArray.length)
return anArray[randomIndex];
}
@samyakbhuta
samyakbhuta / games.js
Created May 27, 2011 16:25
Looking for a implementation solution for a pattern, whose name I don't know yet !!!
----------------- Formation of a game----------------------
db.games.save({
"_id" : ObjectId("4ddf595fb57f547120000002")
"pi" : "3831F237040C4BC083420EE4EC5FAE85",
"di" : "76280583D2DA4903A0336C85AA3B3DE8468E21F8",
"np" : 92,
"p1" : "n",
});
----------------- Formation of a game ends-----------------
[60550.147454] node invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0
[60550.147473] node cpuset=/ mems_allowed=0
[60550.147480] Pid: 6638, comm: node Not tainted 2.6.35.11-83.9.amzn1.x86_64 #1
[60550.147488] Call Trace:
[60550.147503] [<ffffffff8108e818>] ? cpuset_print_task_mems_allowed+0x98/0xa0
[60550.147514] [<ffffffff810bb327>] dump_header.clone.1+0x77/0x1a0
[60550.147525] [<ffffffff8131fd99>] ? _raw_spin_unlock_irqrestore+0x19/0x20
[60550.147535] [<ffffffff811b119f>] ? ___ratelimit+0x9f/0x120
[60550.147543] [<ffffffff810bb4c6>] oom_kill_process.clone.0+0x76/0x140
[60550.147551] [<ffffffff810bb6a8>] __out_of_memory+0x118/0x190
@samyakbhuta
samyakbhuta / load-google-spreadsheet.js
Created July 11, 2011 06:51
Laoding Google Spreadsheet
var sys = require("sys");
var Spreadsheet = require("spreadsheet");
// Instantiate a spreadsheet using the key directly.
var sheet = new Spreadsheet("0AkUwNDE9ftXvdGMxQ2hMS2oySG9HeV9OeUtkZ2xoM1E"); //Works
//var sheet = new Spreadsheet("0Aiorqa2o8GY9dGk1MVNIMmhpZGR5YmRfTzlfdzNwZHc");
// Load the worksheets, callback will be called for each worksheet
sheet.worksheets(function(err,ws){