Skip to content

Instantly share code, notes, and snippets.

View vicneanschi's full-sized avatar

Valeri Vicneanschi vicneanschi

  • Montreal, Canada
View GitHub Profile

Software list

  • Disk utility (osx)
  • Mini Tool Partition Wizard
  • Robomongo
@vicneanschi
vicneanschi / eventemitter.js
Last active August 26, 2015 13:28 — forked from liamcurry/eventemitter.js
Simple Client-side EventEmitter implementation
function EventEmitter() {}
EventEmitter.prototype.on =
EventEmitter.prototype.addListener = function (event, callback) {
this._events = this._events || {};
this._events[event] = this._events[event] || [];
this._events[event].push(callback);
return this;
};
@vicneanschi
vicneanschi / svnlogparser.js
Created December 9, 2015 14:34
Parse svn history to generate stats reports
// get svn log file first:
// svn log -v --xml -r {2015-01-01}:{2015-12-08} > svn.log
var fs = require('fs'),
xml2js = require('xml2js'),
_ = require('lodash'),
path = require('path');
var parser = new xml2js.Parser();
/**
* Created by VV on 2/3/2016.
*/
"use strict";
function PriorityQueue(){
this._nodes = [];
this.enqueue = function (priority, item){
this._nodes.push({priority: priority, item: item});
"use strict";
function Graph(){
this.vertices = {};
//graph.addVertex('vFrom', {'vTo1': 1, 'vTo2': 1});
this.addVertex = function(name, edges) {
this.vertices[name] = edges;
}
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-ddd' ]
2 info using [email protected]
3 info using [email protected]
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
/*
A number is called a circular prime if it is prime and all of its rotations are primes.
For example the number 197 has two rotations: 971, and 719.
Both of them are prime.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
How many circular primes are there below N?
@vicneanschi
vicneanschi / question.txt
Last active March 3, 2016 03:01
Exact Change
Design a cash register drawer function that accepts purchase price as the first argument, payment as the second argument, and cash-in-drawer (cid) as the third argument.
cid is a 2d array listing available currency.
Return the string "Insufficient Funds" if cash-in-drawer is less than the change due. Return the string "Closed" if cash-in-drawer is equal to the change due.
Otherwise, return change in coin and bills, sorted in highest to lowest order.
// Example cash-in-drawer array:
// [["PENNY", 1.01],
function primes(num){
var result = [2, 3];
for(var i = 5; i<= num; i+=2){
if ( result.every( x => i % x ) ) {
result.push(i);
}
}
return result;
}
node --expose-gc --trace-gc --trace-gc-verbose --trace-gc-ignore-scavenger --max-old-space-size=1000 server.js