Skip to content

Instantly share code, notes, and snippets.

View sferik's full-sized avatar

Erik Berlin sferik

View GitHub Profile
# API v1.1, HTTPS
# Expected: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]}
# Raises: EOFError: end of file reached
require 'net/http'
uri = "https://api.twitter.com/1.1/users/show.json?user_id=33978"
Net::HTTP.get(URI(uri))
# API v1, HTTPS
# Expected: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]}
# Raises: EOFError: end of file reached
class Menu
attr_reader :first, :last
def initialize
@first, @last = 2.times.collect{|i| prompt(i + 1)}
end
def prompt(number)
print "Enter number #{number}:\t"
gets.chomp.to_i
@sferik
sferik / homework.md
Last active December 15, 2015 12:09

WDI Homework - March 27, 2013

Tic-Tac-Toe

Create a two-player tic-tac-toe game in Ruby.

Requirements
  • Must define at least two classes
  • Must define at least one exception class
  • Must use at least one Array
  • Must use at least one Hash
@sferik
sferik / why_software_is_eating_the_world.md
Last active December 25, 2019 15:43
Why Software Is Eating The World

Why Software Is Eating The World

August 20, 2011

This week, Hewlett-Packard (where I am on the board) announced that it is exploring jettisoning its struggling PC business in favor of investing more heavily in software, where it sees better potential for growth. Meanwhile, Google plans to buy up the cellphone handset maker Motorola Mobility. Both moves surprised the tech world. But both moves are also in line with a trend I've observed, one that makes me optimistic about the future growth of the American and world economies, despite the recent turmoil in the stock market.

In short, software is eating the world.

class RomanNumeralGenerator
TABLE = {
1000 => "M",
900 => "CM",
500 => "D",
400 => "CD",
100 => "C",
90 => "XC",
50 => "L",
40 => "XL",

WDI Homework - April 1, 2013

SQL

  1. Write a program that converts Roman numerals to Arabic numerals.
  2. Download this SQLite database and write a SQL statement that:
    1. Selects the names of all products that are not on sale.
    2. Selects the names of all products that cost less than $20.
    3. Selects the name and price of the most expensive product.
    4. Selects the name and price of the second most expensive product.
  3. Selects the name and price of the least expensive product.

WDI Homework - April 3, 2013

Sinatra

  1. Finish creating your own version of http://pairprogrammingbot.com/ using Sinatra, ERB templates, and custom CSS (Aron).
  2. Continue working on the Sinatra database application:
    1. Add a layout that yields to a template
    2. Add a /products route that lists all the products in the store database in an HTML table
    3. Add a root route (/) that contains links to the /users and /products pages
    4. Add a back button on /users and /products that takes you back to the home page
  3. Style the tables using CSS
@sferik
sferik / homework.md
Last active December 15, 2015 23:28

WDI Homework - April 8, 2013

Array and Hash access

Given the following data structure:
a = ["Anil", "Erik", "Jonathan"]
  • How would you return the string "Erik"?

WDI Lab - April 8, 2013

Movies

You will be creating a movies app using Sinatra and the OMDB API.

Requirements

  • Ability to search for a movie by title
  • Ability to click on a search result to see detailed information about a movie including:
    • Title
  • Year