View rubygems-timeout.txt
1 2 3
Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Operation timed out - connect(2) for "rubygems.org" port 443 (https://rubygems.org/gems/rspec-rails-3.3.1.gem)
An error occurred while installing rspec-rails (3.3.1), and Bundler cannot continue.
Make sure that `gem install rspec-rails -v '3.3.1'` succeeds before bundling.
View test.rb
1 2 3 4 5 6 7
# including a module as private in ruby, does not change anything
# to test
 
mixin_methods = Mixin.instance_methods
controller = SomeController.new
status = mixin_methods.each_with_object({}) { |x, acc| acc[x] = controller.respond_to?(x) }
status.select { |k,v| !v }.keys # will be empty
View migration_file_with_error.rb
1 2 3 4 5 6 7 8 9
class SetupHstore < ActiveRecord::Migration
def up
execute "CREATE EXTENSION IF NOT EXISTS hstore"
end
 
def down
execute "DROP EXTENSION IF EXISTS hstore"
end
end
View homebrew segfault due to readline
1 2 3 4 5 6 7 8 9 10
➜ ~ brew upgrade wget
 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/readline.bundle: [BUG] Segmentation fault
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
 
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
View consumer.es.js
1
export {Worker} from './package';
View next in yielded method.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
setTimeout(function() {
iterator.next(price++);
}, 300);
}
 
let badStockPrice = function () {
iterator.next(price++);
View wrap_errors_for_generators.es.js
1 2 3 4 5 6 7 8 9 10
// works: https://gist.github.com/deepak/ffe01c81900d12f95658
// does not work: https://gist.github.com/deepak/9a7337d7a641f8af9c8b
 
// difference is that, if error is thrown directly from fucntion called in generator
// then it gives a "Generator is already running" error
// but if it is wrapped in a setTimeout callback then it works
 
// WORKS
 
let price = 10;
View errors_in_generator.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
setTimeout(function() {
iterator.next(price++);
}, 300);
}
 
let errorInStockPrice = function() {
setTimeout(function() {
View get_stock_price.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
setTimeout(function() {
iterator.next(price++);
console.log(price); //=> 10
// why is this logged ? next does not behave like return ?
// and it is always 10. "price++" did not increment value of price
}, 300);
}
View generator.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
// iterator.next(price++); // throws a "Generator is already running" error
return price++
}
 
let oops = function () {
throw new Error("oops!");
}
Something went wrong with that request. Please try again.