- GitHub Staff
- @[email protected]
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(Dir.pwd + "/config/environment") | |
ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config| | |
ActiveRecord::Base.establish_connection(db_config.config) | |
context = ActiveRecord::Base.connection.migration_context | |
missing_migrations = [] |
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
class Range | |
def overlap(other) | |
[self.begin, other.begin].max .. [self.end, other.end].min | |
end | |
end | |
def musical_era_alive_in(start_life, end_life) | |
[ | |
['Medieval', 476..1400], | |
['Renaissance', 1400..1600], |
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
commit 604fd2cb227d92bed1b738e71feb4ff5360f4491 | |
Author: Matthew Draper <[email protected]> | |
Date: Fri Feb 19 07:50:42 2016 +1030 | |
Use a semaphore to signal message availability | |
The Event hack was too much of a hack: on actually thinking about it, | |
there's a rather obvious race. | |
diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb |
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
diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb | |
index d30c381..2662921 100644 | |
--- a/actioncable/test/client_test.rb | |
+++ b/actioncable/test/client_test.rb | |
@@ -54,7 +54,7 @@ def initialize(port) | |
@ws = Faye::WebSocket::Client.new("ws://127.0.0.1:#{port}/") | |
@messages = Queue.new | |
@closed = Concurrent::Event.new | |
- @has_messages = Concurrent::Event.new | |
+ @has_messages = Concurrent::Semaphore.new(0) |
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
diff --git a/lib/sprockets/manifest.rb b/lib/sprockets/manifest.rb | |
index e514ebb..9797575 100644 | |
--- a/lib/sprockets/manifest.rb | |
+++ b/lib/sprockets/manifest.rb | |
@@ -165,6 +165,8 @@ def compile(*args) | |
concurrent_compressors = [] | |
concurrent_writers = [] | |
+ pool = Concurrent::FixedThreadPool.new(5) | |
+ |
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
## | |
# Program to help you hack terminals in Fallout | |
# | |
# Usage: | |
# | |
# Run this program with a '/' separated list of possible words, and | |
# (once you've made a guess) another '/' separated list of words and | |
# scores where the word and score are separated by a ':' | |
# | |
# In this example, the words shown in my terminal were: |
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
diff --git a/spec/helpers/application_helper/toolbar_builder_spec.rb b/spec/helpers/application_helper/toolbar_builder_spec.rb | |
index 546ce2b..81ce5f3 100644 | |
--- a/spec/helpers/application_helper/toolbar_builder_spec.rb | |
+++ b/spec/helpers/application_helper/toolbar_builder_spec.rb | |
@@ -3,11 +3,14 @@ | |
describe ApplicationHelper do | |
before do | |
controller.send(:extend, ApplicationHelper) | |
- self.class.send(:include, ApplicationHelper) | |
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
diff --git a/vmdb/lib/acts_as_ar_model.rb b/vmdb/lib/acts_as_ar_model.rb | |
index e23a20f..d6838a8 100644 | |
--- a/vmdb/lib/acts_as_ar_model.rb | |
+++ b/vmdb/lib/acts_as_ar_model.rb | |
@@ -1,16 +1,3 @@ | |
-class ActsAsArModelColumn < ActiveRecord::ConnectionAdapters::Column | |
- attr_reader :options | |
- | |
- def initialize(name, options) | |
- type = options.kind_of?(Symbol) ? options : options[:type] |
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 | |
if [ "$3" = 1 ]; then | |
old_branch="`git name-rev --name-only --no-undefined "$1" | cut -d'~' -f1`" | |
new_branch="`git name-rev --name-only --no-undefined "$2" | cut -d'~' -f1`" | |
if [ "$old_branch" != "$new_branch" ]; then | |
mv -f "Gemfile.lock" ".Gemfile/lock.$old_branch" | |
if [ -f ".Gemfile/lock.$new_branch" ]; then | |
mv -f ".Gemfile/lock.$new_branch" "Gemfile.lock" |
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
class X < String | |
def evil_call(meth, args, block, &wrap_block) | |
block.binding.eval(<<-END, __FILE__, __LINE__+1).call(to_str, meth, args, wrap_block) | |
lambda do |str, meth, args, block| | |
str.send(meth, *args, &block) | |
end | |
END | |
end | |
def gsub(*args, &block) |
NewerOlder