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
(ns euler.core) | |
(defn multiple-of-3-or-5? [n] (or (= 0 (mod n 3)) (= 0 (mod n 5)))) | |
(defn sum-of-multiples-of-3-or-5-below [n] | |
(apply + (filter multiple-of-3-or-5? (range 1 n)))) | |
(defn fibs [] | |
(map first (iterate (fn [[a b]] [b (+ a b)]) [1N 1N]))) |
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
$ brew install python | |
==> Downloading http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 | |
Already downloaded: /Library/Caches/Homebrew/python-2.7.3.tar.bz2 | |
==> ./configure --prefix=/usr/local/Cellar/python/2.7.3 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.3/share --datadir=/usr/local/Cellar/python/2.7.3/share --enable-framework=/usr/local/Cellar/python/2.7.3/Frameworks --witho | |
==> make | |
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3 | |
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3/share/python | |
==> Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz | |
Already downloaded: /Library/Caches/Homebrew/distribute-0.6.28.tar.gz | |
==> /usr/local/Cellar/python/2.7.3/bin/python -s setup.py --no-user-cfg install --force --verbose --install-lib=/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages --install-scripts=/usr/l |
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 File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
if defined?(Bundler) | |
# If you precompile assets before deploying to production, use this line | |
Bundler.require(*Rails.groups(:assets => %w(development test))) | |
# If you want your assets lazily compiled in production, use this line | |
# Bundler.require(:default, :assets, Rails.env) | |
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 'spec_helper' | |
class SomeRecord | |
attr_accessor :password | |
attr_reader :errors | |
def initialize(attrs = {}) | |
@password = attrs.delete(:password) | |
@errors = ActiveModel::Errors.new(self) | |
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 'rubygems' | |
require 'bundler' | |
require 'bundler/setup' | |
require 'rake/clean' | |
require 'flashsdk' | |
require 'asunit4' | |
namespace :as2 do | |
sprout "as2" |
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
class Order < ActiveRecord::Base | |
has_many :line_items, :dependent => :destroy, :order => "position" | |
accepts_nested_attributes_for :line_items, :allow_destroy => true, :reject_if => lambda { |attributes| attributes["amount"].blank? } | |
validates_associated :line_items | |
private | |
def validate |
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
$ lein plugin install lein-search 0.3.3 | |
Downloading: org/clojure/clojure/1.1.0/clojure-1.1.0.pom from central | |
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.pom from central | |
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.pom from clojure | |
Transferring 1K from clojure | |
Downloading: org/clojure/clojure/1.1.0/clojure-1.1.0.jar from central | |
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.jar from central | |
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.jar from clojure | |
Transferring 3215K from clojure | |
Copying 2 files to /var/folders/Qc/QcHVL6pTFVmL3sdeOxoGwk+++TI/-Tmp-/lein-c20dc40b-5eb0-4755-ae00-3165d3787009/lib |
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
Nov 23, 2010 4:22:16 PM sun.reflect.GeneratedMethodAccessor1 invoke | |
INFO: /!\ FAILSAFE /!\ Tue Nov 23 16:22:16 +0000 2010 | |
Status: 500 Internal Server Error | |
undefined method `merge' for nil:NilClass | |
/root/deployments/bank/current/localgems/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing' | |
/root/deployments/bank/current/localgems/gems/actionpack-2.3.5/lib/action_controller/request.rb:389:in `parameters' | |
/root/deployments/bank/current/localgems/gems/actionpack-2.3.5/lib/action_controller/base.rb:1288:in `assign_shortcuts' | |
/root/deployments/bank/current/localgems/gems/actionpack-2.3.5/lib/action_controller/base.rb:527:in `process' | |
/root/deployments/bank/current/localgems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process_with_filters' | |
/root/deployments/bank/current/localgems/gems/haml-2.2.20/lib/sass/plugin/rails.rb:20:in `process' |
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
$ script/generate migrtion drop_start_date_from_enrollment | |
JRuby limited openssl loaded. http://jruby.org/openssl | |
gem install jruby-openssl for full support. | |
exists db/migrate | |
create db/migrate/20100802182614_drop_start_date_from_enrollment.rb |
NewerOlder