Sublime: Go to Preferences -> Settings -> More -> Syntax Specific -> User. This should open a settings window named Ruby.sublime-settings
{
"tab_size": 2,
"translate_tabs_to_spaces": true
"detect_indentation": false
}
# If instead of monkey patching it you do it this way you don't lose anything | |
def is_valid_expression?(expression) | |
regexp = / | |
\A\d+\.?\d* # any number that contains only one decimal | |
\s+ # white space after first number and before operand | |
[\+\/\-\*] # matches available operands | |
\s+ # white space after first number and before operand | |
\d+\.?\d*$ # any number that contains only one decimal | |
/x |
require 'pry' | |
OPTIONS = {"p" => "Paper", "r" => "Rock", "s" => "Scissors"} | |
def say(message) | |
puts "### #{message}" | |
end | |
def display_winning_message(winning_choice) | |
case winning_choice |
def say(msg) | |
puts "=> #{msg}" | |
end | |
loop do | |
say "What's the first number?" | |
num1 = gets.chomp | |
say "What's the second number?" |
# 1. PRS is a game between two players. Players pick a hand; either "Rock", "Paper", or "Scissors". | |
# 2. One hand is compared against the other and either 1) it is a tie, 2) rock > scissors; 3) scissors > paper; 4) paper > rock. | |
require 'pry' | |
class Player | |
attr_accessor :choice | |
attr_reader :name | |
def initialize(name = nil) |
# Interactive command line blackjack game | |
def calculate_total(cards) | |
# [['H', '3'], ['S', 'Q'], ... ] | |
arr = cards.map{|e| e[1] } | |
total = 0 | |
arr.each do |value| | |
if value == "A" |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'flazz/vim-colorschemes' |
What is the first number? | |
3 | |
What is the second number? | |
3 | |
1) Add | |
2) Subtract | |
3) Multiply | |
4) Divide | |
f | |
Please enter a number from 1 through 4 |
Sublime: Go to Preferences -> Settings -> More -> Syntax Specific -> User. This should open a settings window named Ruby.sublime-settings
{
"tab_size": 2,
"translate_tabs_to_spaces": true
"detect_indentation": false
}
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'flazz/vim-colorschemes' |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list | |
sudo apt-get update && sudo apt-get install elasticsearch | |
sudo update-rc.d elasticsearch defaults 95 10 | |
sudo service elasticsearch start | |
curl http://localhost:9200 |