Get comfortable writing routes and creating ERB views in a very simple Sinatra App.
This file contains hidden or 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 MarketoService | |
| def initialize | |
| @base_url = "https://#{ENV['MARKETO_ID']}.mktorest.com" | |
| @client_id = ENV['MUNCHKIN_CLIENT_ID'] | |
| @client_secret = ENV['MUNCHKIN_CLIENT_SECRET'] | |
| end | |
| def sync_leads(data) | |
| request_url = "#{@base_url}/rest/v1/leads.json?access_token=#{access_token}" |
This file contains hidden or 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
| ActiveRecord::Schema.define(version: 20150423000913) do | |
| # These are extensions that must be enabled in order to support this database | |
| enable_extension "plpgsql" | |
| create_table "active_admin_comments", force: :cascade do |t| | |
| t.string "namespace" | |
| t.text "body" | |
| t.string "resource_id", null: false | |
| t.string "resource_type", null: false |
This file contains hidden or 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 Collatz | |
| def initialize(number) | |
| @sequence_num = number | |
| @sequence_array = [] | |
| @sequence_array << @sequence_num | |
| end | |
| def gen_sequence | |
| until @sequence_num == 1 |
This file contains hidden or 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 User | |
| layout :layout_method | |
| . | |
| . | |
| . | |
| private | |
| def :layout_method | |
| case action_name |
This file contains hidden or 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
| CAVEAT: Arabic number entered must be a whole number and 3999 or less. | |
| arabic_num = 0 | |
| while arabic_num != 'END' | |
| print "Enter an arabic whole number ('end' to quit): " | |
| input = gets.chomp.upcase | |
| unless input == 'END' | |
| arabic_num = input.to_i | |
| roman_numeral = [] |
This file contains hidden or 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
| CAVEAT: I spent ZERO time refactoring this code so I'm quite sure it is not the ideal solution. | |
| roman_num = "" | |
| while roman_num != 'END' | |
| print "Enter a roman numeral ('end' to quit): " | |
| roman_num = gets.chomp.upcase | |
| arabic_num = 0 | |
| last_char_value = 0 | |
| roman_char_array = []; |
This file contains hidden or 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
| 1) What are all the apartment listings? | |
| 1|apt|entire|2|New York City|1 | |
| 2|apt|shared|1|New York City|2 | |
| 3|apt|entire|1|Hoboken|2 | |
| 4|apt|private|2|Jersey City|3 | |
| 5|apt|entire|2|Hoboken|2 | |
| 6|apt|private|2|New York City|1 | |
| 2) What are the listings for an entire home? |
This file contains hidden or 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
| 1) What are all the apartment listings? | |
| 2) What are the listings for an entire home? | |
| 3) What are the listings for apartments in Hoboken? | |
| 4) What are the listings for homes in New York City at most 3 people? | |
| 5) What are the listings belonging to user1? |
This file contains hidden or 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
| 1) Select the price of a flight | |
| SELECT price FROM flight WHERE id = 3; | |
| 2) Select the departing and arriving time of a flight | |
| SELECT departure_time, arrival_time FROM flight WHERE id = 3; | |
| 3) Select all flights that have only one stop. |
NewerOlder