Skip to content

Instantly share code, notes, and snippets.

View natachaS's full-sized avatar
💭
Living life one PR at a time...

Natacha natachaS

💭
Living life one PR at a time...
View GitHub Profile

Interview Prep

General Thoughts for Interviewing

Three Primary Responsibilities

  • Build.
  • Blog.
  • Bresent.

Problem Solving

"Make it work, make it right, make it fast."

require 'sequel'
require 'pry'
DB = Sequel.postgres('chinook')
class Artist < Sequel::Model
end
class Album < Sequel::Model
end
binding.pry
require 'sequel'
require 'pry'
class Artist
# CONN = PG.connect(dbname: 'chinook')
DB = Sequel.postgres('chinook')
attr_accessor *DB[:artists].columns
def self.new_from_row(row)
id = row[:id]
class Artist
attr_reader :subscribers, :name, :label
def initialize(name, label)
@name = name
@label = label
@subscribers = []
end
def add_subscriber(subscriber)
require 'pg'
require 'pry'
class Artist
CONN = PG.connect(dbname: 'chinook')
attr_accessor :id, :name
def self.new_from_row(row)
id = row["id"]
name = row["name"]
require 'pg'
require 'pry'
conn = PG.connect(dbname: 'chinook')
binding.pry
require 'pg'
require 'pry'
class Artist
CONN = PG.connect(dbname: 'chinook')
attr_accessor :id, :name
def self.new_from_row(row)
id = row["id"]
name = row["name"]
require 'pg'
require 'pry'
conn = PG.connect(dbname: 'chinook')
def add_artist(db_conn, name)
sql = <<-SQL
INSERT INTO artists (name)
VALUES ($1) RETURNING id
SQL