Skip to content

Instantly share code, notes, and snippets.

Inokentii Mykhailov gregolsen

Block or report user

Report or block gregolsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .travis.yml
language: ruby
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- cp config/database.travis.yml config/database.yml
- RAILS_ENV=test bundle exec rake db:create db:migrate
gregolsen / gist:5378320
Created Apr 13, 2013
simple way to get routes info
View gist:5378320
require 'rails/application/route_inspector'
all_routes = { |r| r.defaults[:controller] =~ /api\/v1/ }
inspector =
pp inspector.format(all_routes, 'api/v1/inboxes').map { |x| x.split(' ') }
# [["api_v1_inbox",
# "POST",
# "/api/v1/inboxes/:id(.:format)",
# "api/v1/inboxes#update"],
# ["api_v1_inboxes",
View gist:4112908
def to_lambda &block
obj =
obj.define_singleton_method(:_, &block)
return obj.method(:_).to_proc
def with_file(name, &block)
l = to_lambda(&block)
puts "Open file"
f =, "r")
gregolsen / gist:3377065
Created Aug 17, 2012
send numbered emails to mailtrap
View gist:3377065
require 'net/smtp'
(0..9).each do |i|
message = <<-END.split("\n").map!(&:strip).join("\n")
From: Private Person <>
To: A Test User <>
Subject: #{i} message
This is a test e-mail message.
You can’t perform that action at this time.