This file contains 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
Natacha Springer | |
Github Username | |
natachaS | |
Blog Url | |
http://natachaspringer.com/ | |
Tagline | |
Ninja-in-training |
This file contains 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
touch natachaSpringer.txt | |
nano natachaSpringer.txt | |
save with CTRL X ENTER | |
cat natachaSpringer.txt | |
cat natachaSpringer.txt >natachaSpringercopy.txt | |
mv natachaSpringercopy.txt stevenrules.txt | |
cat natachaSpringer.txt stevenrules.txt > everything.txt | |
echo "I like pina coladas and getting caught in the rain" >> everything.txt | |
ls *.txt > textfileslist |
This file contains 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
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 |
This file contains 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
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"] |
This file contains 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
require 'pg' | |
require 'pry' | |
conn = PG.connect(dbname: 'chinook') | |
binding.pry |
This file contains 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
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"] |
This file contains 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 Artist | |
attr_reader :subscribers, :name, :label | |
def initialize(name, label) | |
@name = name | |
@label = label | |
@subscribers = [] | |
end | |
def add_subscriber(subscriber) |
This file contains 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
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] |
This file contains 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
require 'sequel' | |
require 'pry' | |
DB = Sequel.postgres('chinook') | |
class Artist < Sequel::Model | |
end | |
class Album < Sequel::Model | |
end | |
binding.pry |
This file contains 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
cazx cdd |
OlderNewer