Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
adamwiggins / adams-heroku-values.md
Last active November 27, 2024 17:06
My Heroku values

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@myronmarston
myronmarston / my_class_spec.rb
Last active December 11, 2015 14:58
Demonstration of how to override the default implicit subject in rspec.
class MyClass
def initialize
raise "Initialize was called"
end
end
# Declare a shared_context that is included in all example groups
# (using `:example_group => { :file_path => // }` to match all
# example groups.
shared_context "using allocate instead of initalize", :example_group => { :file_path => // } do
@solnic
solnic / rvm_remove_old.sh
Created December 4, 2012 09:34
Remove all rubies older than given date
DATE=2012-06-01
for version in `find $rvm_path/rubies/ -mindepth 1 -maxdepth 1 -type d -not -newermt $DATE | cut -d / -f 7`; do rvm remove $version; done
require "timeout"
module WaitSteps
extend RSpec::Matchers::DSL
matcher :become_true do
match do |block|
begin
Timeout.timeout(Capybara.default_wait_time) do
sleep(0.1) until value = block.call
@mattwynne
mattwynne / integrated_docs.rb
Created November 21, 2012 00:27
Integrated documentation for Ruby
# For context, this was inspired by the RubyRogues podcast #79 where they talked about
# documentation in Ruby, and specifically grumbled quite a bit about the failings of RDoc.
#
# http://rubyrogues.com/079-rr-documenting-code/
#
# As someone who's spent a lot of time using an IDE for programming C# and Java, I think
# Ruby could do a lot better at putting documentation at our fingertips as we program.
#
# Maybe making the documentation part of the structure of the code would facilitate this?
#
Dir.glob(File.join(File.dirname(__FILE__), "../../../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
@jnicklas
jnicklas / gist:3980553
Created October 30, 2012 14:35
Capybara 2.0.0.beta4 release notes.

Hi everyone,

It's been way too long, but I finally managed to get the master branch into a state which could be considered good enough for release. I've just pushed beta4 to Rubygems. Note that this release breaks compatibility with the 1.1.x series of Capybara in major ways, it also is not compatible with previous beta versions in some ways.

Notably, we changed the :type that Capybara assumes your specs run under in RSpec to :feature (previously it was :request). The latest release of spec/features. Alternatively you can use the Capybara Feature DSL (feature instead of describe), which should work without any additional tweaking. If you see errors like undefined method visit, then you're probably encountering this issue. If you're including modules into :request specs, you will probably need to change that to :feature.

This release also drops official support for Ruby 1.8.x. It's time to migrate, folks!

Many thanks to the many contributors for all the help with this release. Without you

@txus
txus / inheritance_is_evil.rb
Created October 28, 2012 15:25
Solution to overuse of inheritance in your code
def Object.inherited(base)
raise "Inheritance is evil. Don't use it." unless self == Object
end