Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mgreenly's full-sized avatar

Michael Greenly mgreenly

View GitHub Profile
class Foo
attr_reader :start, :stop
def initialize(start, stop)
@start, @stop = start, stop
end
def each
return enum_for(:each) unless block_given?
start.upto(stop) do |count|
yield count
end
; monads
;
; references:
; http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
; http://www.intensivesystems.net/tutorials/monads_101.html
;
; define the 'identity' monad
;
(define-class <identity> ()
; monads
;
; references:
; http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
; http://www.intensivesystems.net/tutorials/monads_101.html
; http://en.wikipedia.org/wiki/Monad_(functional_programming)
;
(define-method return (monad)
(make monad :value))
; monads
;
; references:
; http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
; http://www.intensivesystems.net/tutorials/monads_101.html
; http://en.wikipedia.org/wiki/Monad_(functional_programming)
; http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html
; alternate syntax for make monad
(define-syntax return
select
count(*)
from
serial_numbers
join boats on
boats.id = serial_numbers.boat_id
join boat_sizes on
boat_sizes.id = boats.boat_size_id
join chassis on
chassis.id = boats.chassis_id
# Programming Elixir - exercise: ModulesAndFunctions-6
#
# Example:
#
# iex(3)> GuessingGame.search(279, 0..1000)
# is it 500
# is it 250
# is it 375
# is it 312
# is it 281
# Programlog Elixir - exercise: ModulesAndFunctions-6
#
# Example:
# iex> GuessingGame.search(279, 1..1000)
# is it 500?
# is it 250?
# is it 375?
# is it 312?
# is it 281?
# is it 265?
Given /^(?:|I )am on (.+)$/ do |page_name|
visit path_to(page_name)
selenium.wait_for_page_to_load(5)
end
When /^(?:|I )press "([^\"]*)"$/ do |button|
click_button(button)
selenium.wait_for_page_to_load(5)
end
Scenario: unsucessful login
Given "John Doe" is a registered user
And I am on the login page
When I fill in "email" with "John Doe's" user information
And I fill in "password" with "incorrect information"
And I press "Login"
Then I should be on the login page
And I should see "Login unsuccessful!"
@mgreenly
mgreenly / git-config.sh
Created August 29, 2010 15:33
git config
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
git config --global core.editor "vim"
git config --global core.excludesfile ~/.gitignore
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git config --global color.interactive auto