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
def flush | |
@guard.synchronize do | |
unless buffer.empty? | |
old_buffer = buffer | |
begin | |
@log.write(old_buffer.join) | |
rescue Encoding::UndefinedConversionError | |
puts "Enc err" | |
@log.write(old_buffer.map { |b| b.force_encoding(Encoding.default_internal) }.join) | |
puts "Enc Done" |
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
(defn convert-rs | |
[rs keys] | |
(vec (doall | |
(map #(vec (map-values % keys)) rs)))) | |
(defn map-values | |
[r keys] | |
(map #(% r) keys)) | |
(defn users-query |
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
#!bin/bash | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
parse_git_remote() { | |
git remote -v | head -n 1 | sed 's/.*github.com:\(.*\).git .*/\1/' | |
} |
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
# Activate the gem you are reporting the issue against. | |
gem 'activerecord', '3.2.18' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. |
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
begin | |
class_to_load = class_name.constantize | |
class_to_load.new | |
# ... | |
rescue NameError => e | |
# do other things if class_name is not an actual class | |
end |
OlderNewer