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 'vcr' | |
require 'mechanize' | |
VCR.config do |c| | |
c.cassette_library_dir = 'cassettes' | |
c.stub_with :webmock | |
c.default_cassette_options = { :record => :new_episodes } | |
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
require 'vcr' | |
require 'mechanize' | |
VCR.config do |c| | |
c.cassette_library_dir = 'cassettes' | |
c.stub_with :webmock | |
c.default_cassette_options = { :record => :new_episodes } | |
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
source 'http://rubygems.org' | |
gem "vcr", '~> 1.11.2' | |
gem 'mechanize', '~> 2.0.1' |
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
# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Returns the result of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |
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
def fetch[R : Fetchable](s: SQLCursor): R = implicitly[Fetchable[R]].fetch(s) | |
trait Fetchable[R] { | |
def fetch(s: SQLCursor): R | |
} | |
implicit object IntIsFetchable extends Fetchable[Int] { | |
def fetch(s: SQLCursor): Int = s.getInt | |
} |
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
/** Notes from Seth Tisue 2012 NE Scala Symposium presentation | |
* Problem: decoupling, generic code that works for many types and is easily extensible | |
* Serialization example below | |
*/ | |
case class Person(name: String, age: Int) | |
case class Restaurant(name: String, branch: Boolean) | |
/** | |
* 1. overloading |
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
(defmacro diff(expr var) | |
; (pprint "diff") | |
; (pprint expr) | |
; (pprint var) | |
;(pprint (first expr)) | |
;(pprint (second expr)) | |
;(pprint (third expr)) | |
(cond | |
; a' = 0 | |
((numberp expr) 0) |
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
// Set the project name to the string 'My Project' | |
name := "SBTProject" | |
// The := method used in Name and Version is one of two fundamental methods. | |
// The other method is <<= | |
// All other initialization methods are implemented in terms of these. | |
version := "1.0" | |
//Add Repository Path | |
resolvers += "db4o-repo" at "http://source.db4o.com/maven" |
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
abstract class TaskListRestriction | |
case class TaskList(name: String) extends TaskListRestriction { | |
override def toString = name | |
} | |
case class TaskListFilter extends TaskListRestriction | |
case object FilterToday extends TaskListFilter { | |
override def toString = "Today" |
OlderNewer