-
change to the home directory:
cd ~
-
move course_catalog to cource_catalog_original:
mv course_catalog course_catalog_original
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
# rails fundamentals aliases | |
## see all the branches we have locally | |
branches = branch -l | |
## see a oneline summary of log messages | |
logs = log --oneline | |
## add all changed files and commit them with optional message | |
save = !sh -c 'msg=\"Save changes\" && git add -A . && git commit -m \"${1:-$msg}\"' - |
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
# 1. In, MVC, what does the M stand for? | |
# 2. The V? | |
# 3. And, of course, the C? | |
# 4. In what part of MVC did we spend the most time last week? | |
# 5. Change to the project directory |
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
bin/rails generate scaffold course title:string description:text | |
bin/rake db:migrate | |
bin/rails generate migration add_prereqs_to_courses prereqs:string | |
bin/rake db:migrate | |
bin/rails generate model section course:references instructors:string location:string area:string subtitle:string units:string | |
bin/rake db:migrate |
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
# | |
#!optional | |
#!rest | |
#( | |
#\ | |
#\altmode | |
#\backnext | |
#\backspace | |
#\call | |
#\linefeed |
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
# Note: run this file in ruby like this: | |
# $ ruby day04.rb | |
# This is a Ruby class | |
class ReadingMaterial | |
def initialize(contents = nil) | |
@contents = contents | |
end | |
# reader / getter |
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 "concord" | |
require "procto" | |
class DomainService < Module | |
def initialize(*attrs, call: :call) | |
@attrs = attrs | |
@call = call | |
end | |
def included(descendant) |
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
irb(main):016:0> class A | |
irb(main):017:1> def self.const_get!(name) | |
irb(main):018:2> name.split('::').inject(Object) do |klass, cname| | |
irb(main):019:3* if klass.const_defined?(cname) | |
irb(main):020:4> klass.const_get(cname) | |
irb(main):021:4> else | |
irb(main):022:4* klass.const_missing(cname) | |
irb(main):023:4> end | |
irb(main):024:3> end | |
irb(main):025:2> rescue NameError |
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
# Little work for the const_get functionality in Mustache for @locks | |
require "minitest/autorun" | |
module Single | |
end | |
module Nested | |
module Nested | |
module Deep | |
end |
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
module ROM | |
module CSV | |
class Adapter < ROM::Adapter | |
def self.schemes | |
[:csv] | |
end | |
attr_reader :path, :basename |