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
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
before_script:
- cp config/database.travis.yml config/database.yml
- RAILS_ENV=test bundle exec rake db:create db:migrate
notifications:
email:
- interstellar.team@railsware.com
@gregolsen
gregolsen / gist:5378320
Created Apr 13, 2013
simple way to get routes info
View gist:5378320
require 'rails/application/route_inspector'
all_routes = Rails.application.routes.routes.select { |r| r.defaults[:controller] =~ /api\/v1/ }
inspector = Rails::Application::RouteInspector.new
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 = Object.new
obj.define_singleton_method(:_, &block)
return obj.method(:_).to_proc
end
def with_file(name, &block)
l = to_lambda(&block)
puts "Open file"
f = File.open(name, "r")
@gregolsen
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 <me@fromdomain.com>
To: A Test User <test@todomain.com>
Subject: #{i} message
This is a test e-mail message.
END
You can’t perform that action at this time.