Skip to content

Instantly share code, notes, and snippets.

View rodriguezd's full-sized avatar

David Rodriguez rodriguezd

View GitHub Profile
@rodriguezd
rodriguezd / gist:76c86d3fc020a39cbdefa8c1b7a85c07
Last active October 23, 2017 19:34
Marketo API calls to create SalesForce lead
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}"
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
class Collatz
def initialize(number)
@sequence_num = number
@sequence_array = []
@sequence_array << @sequence_num
end
def gen_sequence
until @sequence_num == 1
class User
layout :layout_method
.
.
.
private
def :layout_method
case action_name

Student Sinata App: Part Zero

Objective

Get comfortable writing routes and creating ERB views in a very simple Sinatra App.

Tutorial

Part 1: Bootstrap the app

@rodriguezd
rodriguezd / Ruby: Arabic to Roman
Last active December 18, 2015 07:19
Ruby program that converts arabic numbers into their corresponding roman numeral value. Arabic value entered must be a whole number and 3999 or less.
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 = []
@rodriguezd
rodriguezd / Ruby: Roman to Arabic
Last active December 18, 2015 07:08
Ruby program that converts roman numerals into their corresponding arabic numeral value. Roman numerals must be entered in valid format.
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 = [];
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?
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?
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.