Skip to content

Instantly share code, notes, and snippets.

@opheliasdaisies
opheliasdaisies / Tic-Tac-Toe
Created August 22, 2013 15:26
A game of tic-tac-toe.
var Board = {
A1:" ",
A2:" ",
A3:" ",
B1:" ",
B2:" ",
B3:" ",
C1:" ",
C2:" ",
C3:" "
@opheliasdaisies
opheliasdaisies / Ruby FizzBuzz
Last active December 28, 2015 09:29
FizzBuzz written in Ruby
101.times do |i|
next if i == 0
if i % 15 == 0
puts "fizzbuzz"
elsif i % 3 == 0
puts "fizz"
elsif i % 5 == 0
puts "buzz"
else puts i
end
@opheliasdaisies
opheliasdaisies / One-Line FizzBuzz
Created November 15, 2013 05:13
FizzBuzz written in one line
puts (1..100).map { |i| (fb = [["Fizz"][i % 3], ["Buzz"][i % 5]].compact.join).empty? ? i : fb }
@opheliasdaisies
opheliasdaisies / One-Line FizzBuzz Expanded
Created November 15, 2013 05:30
Expansion of the one-line FizzBuzz
(1..100).map do |i|
fb_a = [["Fizz"][i % 3], ["Buzz"][i % 5]]
fb = fb_a.compact.join
if fb.empty?
puts i
else
puts fb
end
end
require "./max_solution"
describe "#maximum" do
it "should return the largest element of the array" do
expect(maximum([43, 32, 45, 23])).to eq(45)
end
it "should return the largest element of the array" do
expect(maximum([4, 0, 1, 2, 3])).to eq(4)
end
it "should return an empty array if given an empty array" do
require "bundler"
Bundler.require
require "./lib/compliment"
require "yaml"
module Compliments
class App < Sinatra::Application
compliments = YAML.load(File.read("./compliments.yaml"))
source "https://rubygems.org"
gem "sinatra"
group :development do
gem "shotgun"
gem "tux"
end
<div class="message"><%= @compliment.message %></div>
<div class="right-content">
<img src="<%= @compliment.image %>">
<a href="/compliments">
<div class="button">
<p>Are you still sad?</p>
</div>
</a>
</div>
a {
background-color: #CCC;
display: block;
margin: 25px;
width: 220px;
text-align: center;
padding: 15px;
border-radius: 10px;
text-transform: uppercase;
text-decoration: none;
.tardis {
box-sizing: content-box;
with: 50ft;
padding: 300ft;
border: 0.5ft;
margin: all_of_time_and_space;
}