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
module Expose | |
def expose(*methods) | |
attr_reader *methods # for when you still only assign ivars in the action | |
helper_method *methods | |
end | |
end | |
ActionController::Base.extend Expose |
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 Person < Struct.new(:name, :language) | |
def initialize(*) | |
super | |
freeze | |
end | |
end | |
rob = Person["rob", "scala"] |
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
default: | |
nl: | |
activerecord: | |
attributes: | |
job_offering: &job_offering_attributes | |
function_name: Functienaam | |
errors: | |
messages: &errors_messages | |
blank: moet ingevuld worden | |
activemodel: |
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
$ rspec spec -fd -p | |
0.021032 | |
User | |
has a name | |
has a name | |
Top 2 slowest examples: | |
User has a name |
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 User < ActiveRecord::Base | |
def name | |
"#{first_name} #{last_name}" | |
end | |
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
User | |
has a name | |
has a name | |
is really slow (FAILED - 1) | |
Failures: | |
1) User is really slow | |
Failure/Error: Unable to find matching line from backtrace | |
too slow, it took 0.0105 seconds |
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
RSpec.configure do |config| | |
config.before(:each) do | |
@__started_time = Time.now | |
end | |
config.after(:each) do | |
ran = @__ended_time - Time.now | |
ran.should be < ENV['MAX_TIME_PER_SPEC'] | |
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
# The discussion is about two styles of interfaces. | |
# The first option is to use enumerable to make it look like an array | |
# The second option is to just return another array | |
# Of course in real life the class does more than this, this is just an example. | |
# What is your preference or opinion on this? Please comment :) | |
# option 1: include Enumerable: | |
class ActiveWidgets |
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
diff --git a/gc.c b/gc.c | |
--- a/gc.c | |
+++ b/gc.c | |
@@ -77,6 +77,41 @@ void *alloca (); | |
#ifndef GC_MALLOC_LIMIT | |
#define GC_MALLOC_LIMIT 8000000 | |
#endif | |
+#define HEAP_MIN_SLOTS 10000 | |
+#define FREE_MIN 4096 | |
+ |
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
#!/usr/bin/env ruby | |
CUCUMBER_PORT = 8990 | |
RSPEC_PORT = 8989 | |
def running?(port) | |
`netstat -an` =~ /\b#{port}\b/m | |
end | |
START_CUCUMBER = "spork cuc -p #{CUCUMBER_PORT}" |