Skip to content

Instantly share code, notes, and snippets.

View plukevdh's full-sized avatar
🔥

Luke van der Hoeven plukevdh

🔥
View GitHub Profile
# RSpec matcher to spec delegations.
# Forked from https://gist.github.com/ssimeonov/5942729 with fixes
# for arity + custom prefix.
#
# Usage:
#
# describe Post do
# it { is_expected.to delegate(:name).to(:author).with_prefix } # post.author_name
# it { is_expected.to delegate(:name).to(:author).with_prefix(:any) } # post.any_name
# it { is_expected.to delegate(:month).to(:created_at) }
@plukevdh
plukevdh / conditiona_validations.rb
Last active August 29, 2015 14:04 — forked from ibanez270dx/ConditionalValidations.rb
conditional validations in Rails 4+
module ConditionalValidations
extend ActiveSupport::Concern
attr_accessor :conditional_validations
def conditional_validations
@conditional_validations || []
end
def conditionally_validate(attribute, options=nil)
require 'benchmark/ips'
Benchmark.ips do |x|
RESULT = [1]
x.report('first') do |times|
i = 0
while i < times
id = RESULT.first
i += 1
@plukevdh
plukevdh / SwitchToFile.py
Created October 8, 2012 16:04 — forked from jbjornson/SwitchToFile.py
Show a input panel to switch to a currently open file
import sublime, sublime_plugin, os
# -------------------------------------------
# You will need to create a key mapping for this, something like:
# { "keys": ["alt+e"], "command": "switch_to_file" }
# -------------------------------------------
class SwitchToFileCommand(sublime_plugin.WindowCommand):
def run(self):
self.display_list = []
self.views = []
@plukevdh
plukevdh / Gemfile
Created March 18, 2010 15:41 — forked from jamiecobbett/Gemfile
Bundler for Rails2.x (from http://gembundler.com/rails23.html)
source :gemcutter
gem "rails", "~> 2.3.5"
gem "sqlite3-ruby", :require => "sqlite3"
# bundler requires these gems in all environments
# gem "nokogiri", "1.4.2"
# gem "geokit"
group :development do
# bundler requires these gems in development