Skip to content

Instantly share code, notes, and snippets.

def to_roman(num)
str = ''
# Your code here
if num >= 1000
str += 'M' * (num / 1000)
num %= 1000
end
if num == 900
str += 'CM'
def deaf_aunty
conversation_done = false
until conversation_done
puts 'Say something to aunty'
reply = gets.chomp
if reply == reply.upcase
puts 'NO, WE CAN\'T DO THAT!'
elsif reply == 'I love ya, aunty, but I\'ve got to go'
def triangle_up(num, char)
1.upto(num) { |i| puts char * i }
end
def triangle_down(num, char)
num.downto(1) { |i| puts char * i }
end

SAPPHIRE EMERALD DIAMOND PEARL

RUBY!

  • Fun fact

  • Script

    • A script is a text file containing commands/codes/instructions that you write and pass to the a program to run.
  • Terminal

    • Also known as shell
  • The shell is a program that takes keyboard commands and passes them to the operating system to carry out.

@KevinSia
KevinSia / index.html
Last active July 23, 2016 14:58 — forked from anonymous/index.html
JS Bin// source http://jsbin.com/xihegu
<!DOCTYPE html>
<html>
<head>
<script src="https://fb.me/react-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
require 'Benchmark'
class Sudoku
attr_accessor :puzzle
def initialize
@puzzle = ''
@game = Array.new(9)
@game.map! { Array.new(9) }
9.times do |i|

#SQL notes

  • SELECT within SELECT
    • select each country in Europe and show their population in percentage of population of Germany
    SELECT name, CONCAT(ROUND(population/(SELECT population FROM world WHERE NAME = 'Germany')*100), '%') 
    FROM world
    WHERE continent = 'Europe'
  • ALL to run through a database list made with SELECT