Skip to content

Instantly share code, notes, and snippets.

View gabrielfurini's full-sized avatar
🏠
Working from home

Gabriel Furini gabrielfurini

🏠
Working from home
View GitHub Profile
@gabrielfurini
gabrielfurini / cash-machine.js
Created April 5, 2016 03:27
Javascript CASH MACHINE
//*** CASH MACHINE ***//
//THE PROBLEM
//Develop a solution that simulate the delivery of notes when a client does a withdraw in a cash machine.
//THE BASIC REQUIREMENTS ARE THE FOLLOW:
// Always deliver the lowest number of possible notes;
// It's possible to get the amount requested with available notes;
// The client balance is infinite;
// Amount of notes is infinite;
@gabrielfurini
gabrielfurini / java-velocity-randomize-array
Last active August 29, 2015 14:23
Randomizing an array in Java Velocity using Fisher-Yates shuffle method
#set($array = [0..10])
#foreach($i in $array)
#if($i.class != "class java.lang.Integer")
#set($i = $math.sub($velocityCount, 1))
#end
#if($i < $array.size())
#set($j = $math.random(0, $math.add($i, 1)))
#set($temp = $array.get($i))
#set($array[$i] = $array.get($j))
@gabrielfurini
gabrielfurini / redirectr.js
Created May 19, 2015 05:18
NODE.JS Redirectr: A simple script to write new folders/files with a content that you desire
/****** NodeJS Redirecter *******/
/* A simple script to write new folders/files based on an array with a content that you desire */
/* IMPORTANT: All folders/files with the same name in the directory will be overwritten */
'use strict';
var fs = require('fs'),
folders = ['folder1', 'folder2', 'folder3'],
fileName = 'index.htm';