Skip to content

Instantly share code, notes, and snippets.

'use strict';
//---------------------------------Array of k arrays ----------------------------------------
var kArrays = [];
var calcRandN = function () {
return Math.floor(Math.random() * 100); //returns random number less than 100
}
@rahul1346
rahul1346 / employer_model.js
Last active August 29, 2015 14:16
express/sequelize
'use strict';
var Sequelize = require('sequelize');
module.exports = function (sequelize, DataTypes) {
var Employer = sequelize.define("Employer", {
username: DataTypes.STRING,
password: DataTypes.STRING
});
return {
@rahul1346
rahul1346 / http_server.js
Created February 17, 2015 00:48
Vanilla node server
'use strict';
var http = require("http");
var url = require("url");
function start(route, handle) {
function onRequest(request, response) {
if (typeof(handle[request.url]) === 'function') {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " received.");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
void process(char * str); // calls the process fxn and passes str
long interpret(long scope, long first, long last);
#define eps 1e-6
@rahul1346
rahul1346 / checkers.js
Created December 16, 2014 06:36
Checkers game for
var board, currentPlayer;
var resetBoard = function () {
board = [
[' X ', 'wht', ' X ', 'wht', ' X ', 'wht', ' X ', 'wht'],
['wht', ' X ', 'wht', ' X ', 'wht', ' X ', 'wht', ' X '],
[' X ', 'wht', ' X ', 'wht', ' X ', 'wht', ' X ', 'wht'],
[' X ', ' X ', ' X ', ' X ', ' X ', ' X ', ' X ', ' X '],
[' X ', ' X ', ' X ', ' X ', ' X ', ' X ', ' X ', ' X '],
['red', ' X ', 'red', ' X ', 'red', ' X ', 'red', ' X '],