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
--display-cop-names | |
--extra-details | |
--display-style-guide |
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
require 'resolv' | |
class DnsCheck | |
attr_reader :host | |
def initialize(host) | |
@host = host | |
end | |
def a | |
@a ||= Resolv::DNS.new.getresources(host, Resolv::DNS::Resource::IN::A) |
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 | |
require "readline" | |
APP_NAME = ARGV[0] | |
unless APP_NAME | |
STDERR.puts "Usage: #{$0} HEROKU_APP_NAME" | |
exit 1 | |
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
# On "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]", but should be the same on all 1.9+ | |
require 'coverage' | |
Coverage.start | |
require './foo' | |
puts Coverage.result | |
# {"foo.rb"=>[1, 1, 0, nil, nil, 1, 0, nil, nil]} | |
Coverage.start | |
Foo.new.bar | |
puts Coverage.result |
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
# Blocks while a client is connected, and does not time out automatically | |
require 'socket' | |
require 'etc' | |
Socket.unix_server_loop("/tmp/sock") do |socket| | |
begin | |
login = Etc.getpwuid(socket.getpeereid.first).name | |
puts "#{login} connected" | |
input = socket.gets.strip | |
puts "#{login} sent #{input}" |
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
# Works as expected | |
$ rvm use 1.9.2 | |
Using /Users/colszowka/.rvm/gems/ruby-1.9.2-p136 | |
~ 1.9.2-p136 $ irb | |
>> "1.9".respond_to?(:encoding) | |
=> true | |
>> 7.123.round | |
=> 7 | |
>> 7.123.round(2) | |
=> 7.12 |
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/ruby | |
# | |
# Migration Tool for Redmine issue and time entry comments from SVN revisions to Git (i.e. r1234 => commit:abcdef789) | |
# ============================== | |
# (c) 2009 Christoph Olszowka & Sebastian Georgi, Capita Unternehmensberatung | |
# | |
# We used this when we migrated two of our main repositories from svn to git (see http://gist.github.com/139478) | |
# and wanted to have our revision links in Redmine reflect that change, too. | |
# |
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
# | |
# Migration tool from SVN to git | |
# ============================== | |
# (c) 2009 Christoph Olszowka, Capita Unternehmensberatung | |
# | |
# This is not meant for usage in an actual shell script - you're better off running | |
# each individual block (marked by the comments) separately and check the output to see if everything | |
# went right - this is more a writeup of the required steps so I can remember them rather than a | |
# shoot-and-forget-solution. | |
# |
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
# | |
# Will find the rdoc paths of your local gems and generate a html index frameset which will let you select | |
# the desired gem's rdoc from a dropdown navigation... | |
# | |
# Specify your local gems installation's doc directory and the desired html output path, open the generated index.html | |
# in the output path in your favorite browser and add a boomark. | |
# You might want to add the script into your path for easy access or put it in a cron job. | |
# | |
# Tested on Ubuntu 8.10, but really should work anywhere with proper gem install path set | |
# |