Public Gists by jimweirich

Gravatar
Mon Nov 16 08:38:40 -0800 2009
1
2
3
class C
  CC = Object.new
  def self.new
Gravatar
Fri Sep 18 13:18:04 -0700 2009
1
2
3
;; Exercise 1.8. Newton's method for cube roots is based on the fact
;; that if y is an approximation to the cube root of x, then a better
;; approximation is given by the value
Gravatar
Fri Sep 18 13:07:20 -0700 2009
1
2
3
;; SICP 1.7
 
;; Exercise 1.7. The good-enough? test used in computing square roots
Gravatar
Fri Sep 18 13:04:16 -0700 2009
1
2
3
;; SICP 1.5
 
;; Exercise 1.5. Ben Bitdiddle has invented a test to determine
Gravatar
Fri Sep 18 12:42:52 -0700 2009
1
2
3
;; SICP 1.5
 
;; Given:
Gravatar
Fri Sep 18 12:35:33 -0700 2009
1
2
3
;; SICP 1.4
;;
;; Exercise 1.4. Observe that our model of evaluation allows for
Gravatar
Fri Sep 18 12:32:48 -0700 2009
1
2
3
;; SICP 1.3
 
;; Exercise 1.3. Define a procedure that takes three numbers as
Gravatar
Fri Sep 18 12:28:18 -0700 2009
1
2
3
;; SICP Exercise 1.2:
 
;; Translate the following expression into prefix form
Gravatar
Fri Sep 18 12:20:00 -0700 2009
1
2
3
;; Exercise 1.1. Below is a sequence of expressions. What is the
;; result printed by the interpreter in response to each expression?
;; Assume that the sequence is to be evaluated in the order in which
Gravatar
Sat Sep 12 17:34:00 -0700 2009
1
2
3
[Object|should_receive();new_instances();flexmock_get();flexmock_teardown();flexmock_verify()]
[Object]obj<->flexmock_proxy[PartialMockProxy|should_receive()]
[PartialMockProxy]->mock[Mock|should_receive()]
Gravatar
Tue Jul 07 13:06:15 -0700 2009
1
2
3
%w(some_method some_other_method).each do |method|
  it "should call #{method}" do
    obj.should_receive(:some_method).once
Gravatar
Fri Jun 12 11:55:10 -0700 2009
1
2
3
; Church Numerals in Clojure
;
; Church numerals use anonymous functions to represent numbers.
Gravatar
Thu Jun 11 08:34:04 -0700 2009
1
2
3
RUBY = File.join(
    Config::CONFIG['bindir'],
    Config::CONFIG['ruby_install_name'] + Config::CONFIG['EXEEXT']).
Gravatar
Thu Jun 04 12:22:54 -0700 2009
1
2
3
(defn reject-multiples
  "A function that rejects multiples of n."
  [n]
Gravatar
Thu May 28 09:26:42 -0700 2009
1
2
3
module ConcernedParent
  module ClassMethods
    def children
Gravatar
Thu May 28 09:26:06 -0700 2009
1
2
3
class Parent
  class << self
    def children
Gravatar
Fri May 15 13:05:36 -0700 2009
1
2
3
# COMMUNITY CHALLENGE
#
# How would you test this Quiz#problem method? Only two rules:
Gravatar
Fri May 15 13:04:12 -0700 2009
1
2
3
# COMMUNITY CHALLENGE
#
# How would you test this Quiz#problem method? Only two rules:
Gravatar
Wed May 06 17:10:08 -0700 2009
1
2
3
#!/usr/bin/env ruby
 
# Execute the git, gem, or rake command, depending on the second argument
Gravatar
Tue Apr 21 17:31:58 -0700 2009
1
2
3
#!/bin/sh
 
export GEM_HOME=/Users/jim/local/ruby19.gems