This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe ListingsController, :type => :controller do | |
render_views | |
let(:json) { JSON.parse(response.body) } | |
describe "GET /listings.json" do | |
before do | |
get :index, format: :json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hello | |
def call(env) | |
[200, {'Content-Type' => 'text/html'}, ["Hello Rack!"]] | |
end | |
end | |
run Hello.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |config| | |
# Use color in STDOUT | |
config.color_enabled = true | |
# Use color not only in STDOUT but also in pagers and files | |
config.tty = true | |
# Use the specified formatter | |
config.formatter = :progress # :progress, :html, :textmate | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # Roman Numerals | |
# The Romans were a clever bunch. They conquered most of Europe and ruled it for hundreds of years. They invented concrete and straight roads and even bikinis. One thing they never discovered though was the number zero. This made writing and dating extensive histories of their exploits slightly more challenging, but the system of numbers they came up with is still in use today. For example the BBC uses Roman numerals to date their programmes. | |
# The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice these letters have lots of straight lines and are hence easy to hack into stone tablets). | |
# Write a function to convert from normal numbers to Roman Numerals: e.g. | |
# ``` | |
# 1 => I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pigeon_data = { | |
:color => { | |
:purple => ["Theo", "Peter Jr.", "Lucky"], | |
:grey => ["Theo", "Peter Jr.", "Ms .K"], | |
:white => ["Queenie", "Andrew", "Ms .K", "Alex"], | |
:brown => ["Queenie", "Alex"] | |
}, | |
:gender => { | |
:male => ["Alex", "Theo", "Peter Jr.", "Andrew", "Lucky"], | |
:female => ["Queenie", "Ms .K"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # Binary Secret Handshake | |
# > There are 10 types of people in the world: Those who understand binary, and those who don't. | |
# You and your fellow flatirons are of those in the "know" when it comes to binary decide to come up with a secret "handshake". | |
# ``` | |
# 1 = wink | |
# 10 = double blink | |
# 100 = close your eyes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download this file: | |
# https://gist.github.com/scottcreynolds/ac1b5c8d96de0c91bf7c/download | |
# Run it from your terminal with: | |
# ruby ruby_phone_format.rb | |
# (Just make sure you are in the right directory) | |
# ====================================== | |
# Ignore All This Code | |
# ====================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prime?(number) | |
tries = 0 #keep track for efficiency | |
prime = !(2...number).any? do |i| | |
tries += 1 | |
number % i == 0 | |
end | |
#is prime if it is NOT divisible by any number evenly from 2 through the number | |
prime_in_words = prime ? "prime" : "not prime" #if true, else false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
game = | |
{ | |
:team1 => | |
{ | |
:name => "New York Necks", | |
:colors => ["yellow", "brown"], | |
:players => | |
{ | |
"Giraffe 1" => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'open-uri' | |
html_tag = | |
'<html> | |
<head> | |
</head> | |
<body> | |
<ul> | |
LI TAGS |
NewerOlder