Related Posts
[CODE/JAVA] Scanner – read a full line
I was solving problems at HackerRank to teach a friend how to code in Java and to process the input data it’s convenient to use Java’s built in Scanner class. However, in one of the problems we wanted to read a whole line at once and we noticed that the Scanner’s API is geared towards […]
Get a randomly weighted key in a Map/Dictionary/Associative Array
Here’s a very useful function to retrieve a randomly weighted key from an associative array in PHP. Sometimes you need to fetch random elements from a collection but you need some elements to have a little more chance than others to be fetched (business rules or whatever…) [php] srand(time()); //dont call this inside the function […]

My Git Cheat-sheet
I don’t know if it’s the crazy syntax, but for the life of me, I always need to come back to this cheat sheet, maybe you will too: GIT CHEATSHEET fetch remote branch. git fetch origin nameofbranch “fetch” downloads the changes of the remote branch but doesn’t automatically merge them. If you have commited local […]