Skip to content

Instantly share code, notes, and snippets.

@r1ckhenry
r1ckhenry / output.rb
Last active August 29, 2015 14:24
output
[["house", 0, 9, 0, 0], ["fences", 0, 9, 0, 0], ["and", 0, 9, 0, 0], ["gates", 0, 9, 0, 0], ["iron", 2, 20, 20000, 0], ["fencing", 2, 20, 20000, 0], ["gatehouse", 2, 14, 2520000, 0], ["vinyl", 2, 14, 2520000, 0], ["fence", 2, 14, 2520000, 0], ["handrails", 0, 76, 0, 0], ["for", 0, 76, 0, 0], ["stairs", 0, 76, 0, 0], ["lowes", 1, 1, 2090000, 0], ["vinyl", 1, 1, 2090000, 0], ["fencing", 1, 1, 2090000, 0], ["prices", 1, 1, 2090000, 0], ["fencing", 1, 95, 390000, 0], ["options", 1, 95, 390000, 0], ["above", 1, 4, 1190000, 0], ["ground", 1, 4, 1190000, 0], ["pool", 1, 4, 1190000, 0], ["fences", 1, 4, 1190000, 0], ["gray", 1, 5, 190000, 0], ["vinyl", 1, 5, 190000, 0], ["fence", 1, 5, 190000, 0], ["panels", 1, 5, 190000, 0], ["pvc", 1, 1, 580000, 0], ["railing", 1, 1, 580000, 0], ["bracket", 1, 1, 580000, 0], ["white", 1, 4, 850000, 0], ["composite", 1, 4, 850000, 0], ["deck", 1, 4, 850000, 0], ["railing", 1, 4, 850000, 0], ["how", 1, 1, 30000, 0], ["mych", 1, 1, 30000, 0], ["does", 1, 1, 30000, 0], ["a", 1, 1, 3000
@r1ckhenry
r1ckhenry / gist:922f5851bb51998ebdb5
Created October 7, 2015 12:05
Lothian Tram Lines
Overview
Calculate stops between stations on tram lines.
Tasks
Take the line and stop that a user is getting on at and the line and stop that user is getting off at and print the total number of stops for the trip.
There are 3 tram lines:
Line 1 has the following stops: Airport, Gyle Centre, Edinburgh Park, Murrayfield Stadium, Haymarket, Princes Street, and York Place
@r1ckhenry
r1ckhenry / main.rb
Created October 15, 2015 14:28
FaceClan
# main.rb
require 'pry-byebug'
require 'pg'
def db
@db ||= PG.connect(dbname: 'faceclan', host: 'localhost')
end
def menu
# Clear the screen, and present the user with a menu
@r1ckhenry
r1ckhenry / stock_lab.md
Created October 20, 2015 12:46
Stock Lab

Stock Lab - 1.5hrs

You are going to create a simple Sinatra application that looks up Stock Exchange prices and returns the price to the user.

  1. Create a one page Sinatra app (just one route to "/").
  2. Use HTML and CSS to customise the layout.
  3. Add a form with a field for the stock symbol, and a button to submit.
  4. After the form is submitted, display to the user the stock symbol and the current price (retrieved from the internet using a Ruby gem -- you'll need to find one).
@r1ckhenry
r1ckhenry / clanmarkr.md
Created October 23, 2015 09:21
Bookmarker App

ClanMarkr - bookmarking app Using the Sinatra experience we've gained this week, create an app where users can store urls of websites they've visited.

From the homepage, the user should be able to add a new URL and give it a name/title and classify it into a genre.

The user should also be able to edit and delete bookmarks.

Finally, there should be the ability to view bookmarks by genre.

Add some unique-to-you feeling to the app too!

@r1ckhenry
r1ckhenry / git_homework.md
Created November 16, 2015 14:33
Git Homework - Day 1

#Git Homework - Day 1

##Local

  1. Create a folder
  • Initialize a git repository in the folder
  • Create a couple of text files .txt
  • Stage the files
  • Commit the files to the repository
  • Change the files
  • Commit the changes
@r1ckhenry
r1ckhenry / hashes_loops.md
Last active November 18, 2015 14:40
Hashes and Arrays

Array and Hash Questions

A. Given the following data structure:

lines = ['Gyle Centre', 'Edinburgh Park', 'Murrayfield Stadium', 'Haymarket', 'Princes Street']
  • Work out how many stops there are in the lines array
  • Return 'Edinburgh Park' from the array

ClanMarkr - bookmarking app Using the Sinatra experience we've gained this week, create an app where users can store urls of websites they've visited.

From the homepage, the user should be able to add a new URL and give it a name/title and classify it into a genre.

The user should also be able to edit and delete bookmarks.

Finally, there should be the ability to view bookmarks by genre.

Add some unique-to-you feeling to the app too!

Weather App Build an app that requests data from your server, based on an input location, which in turn requests it from a weather API:

http://openweathermap.org/api

Your app should be able to:

Take user input for a location and display the current weather data. Your app could be able to (Extension 1):

Perform the following operations, and then show us the result of running the history command.

  • Open a terminal window and create a directory in your home directory called "unix".
  • Change directory into the unix directory and create two more directories called "fruit" and "vegetables".
  • In the "fruit" directory, create files called "apple", "orange", "lemon", "pear".
  • In the "vegetables" directory, create files called "carrot", "tomato", "squash".
  • Rename "lemon" to be "grapefruit".
  • Move "tomato" from "vegetables" to "fruit".