Skip to content

Instantly share code, notes, and snippets.

View lovemercybiz's full-sized avatar

Love Slaughter lovemercybiz

View GitHub Profile
@malandrina
malandrina / gist:3744867
Created September 18, 2012 18:26
Implementing a Reverse Polish Notation Calculator in Ruby

Implementing a Reverse Polish notation calculator in Ruby

A couple weeks ago I had a go at implementing an RPN calculator in Ruby. I knew I wanted the calculator to function by popping operands out of an array populated with the values of the input expression, operating upon the operands with the appropriate operator, and pushing the result back into the stack of operands.

I was able to implement this in version 1, but it took forever and the resulting code was not very beautiful. Why?

  • I started coding before I had a thorough understanding of RPN

    Wait, 20 10 5 4 + * - is what now?

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@pwittchen
pwittchen / ifconfig.js
Created January 17, 2017 16:23
executing shell command via JS - on Linux nodejs ifconfig.js; on macOS node ifconfig.js
var process = require('child_process');
process.exec('ifconfig',function (err,stdout,stderr) {
if (err) {
console.log("\n"+stderr);
} else {
console.log(stdout);
}
});
@farishkash
farishkash / gist:528b525e147ebf739e28243f777b4b8f
Created April 27, 2017 23:59
Linux commands to install Ruby on Rails on Windows 10
Initial linux update
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
rbenv setup
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active June 25, 2024 22:17
Online Resources For Web Developers (No Downloading)