Skip to content

Instantly share code, notes, and snippets.

View elskwid's full-sized avatar
🤡

Don Morrison elskwid

🤡
View GitHub Profile
@elskwid
elskwid / git-aliases.txt
Created October 14, 2014 23:22
Git Aliases for Ruby Fundamentals class
# 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}\"' -
@elskwid
elskwid / day03.rb
Last active August 29, 2015 14:07
Ruby on Rails Fundamentals Warmup Day 03
# 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
@elskwid
elskwid / slacker.txt
Created October 15, 2014 01:15
JACOB WAS A SLACKER AND MISSED CLASS
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
#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@elskwid
elskwid / day04.rb
Created October 17, 2014 00:08
Ruby on Rails Fundamentals Warmup Day 04
# 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
@elskwid
elskwid / domain_service.rb
Last active August 29, 2015 14:07
Little domain service thing
require "concord"
require "procto"
class DomainService < Module
def initialize(*attrs, call: :call)
@attrs = attrs
@call = call
end
def included(descendant)
@elskwid
elskwid / final_countdown.md
Created October 24, 2014 01:04
Final Countdown

Rails Fundamentals The Final Countdown

Move our original project:

  • change to the home directory:

    • cd ~
  • move course_catalog to cource_catalog_original:

    • mv course_catalog course_catalog_original
@elskwid
elskwid / constget.txt
Created December 1, 2014 17:24
borked lookup
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
@elskwid
elskwid / const_get.rb
Last active August 29, 2015 14:10
Mustache .const_get! for locks
# Little work for the const_get functionality in Mustache for @locks
require "minitest/autorun"
module Single
end
module Nested
module Nested
module Deep
end
@elskwid
elskwid / csv_adapter.rb
Created December 19, 2014 18:46
WIP ROM csv adapter
module ROM
module CSV
class Adapter < ROM::Adapter
def self.schemes
[:csv]
end
attr_reader :path, :basename