This file contains hidden or 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
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. |
This file contains hidden or 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
# 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 |
This file contains hidden or 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 SetupHstore < ActiveRecord::Migration | |
def up | |
execute "CREATE EXTENSION IF NOT EXISTS hstore" | |
end | |
def down | |
execute "DROP EXTENSION IF EXISTS hstore" | |
end | |
end |
This file contains hidden or 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
➜ ~ 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 |
This file contains hidden or 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
export {Worker} from './package'; |
This file contains hidden or 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
let price = 10; | |
let stockPrice = function () { | |
setTimeout(function() { | |
iterator.next(price++); | |
}, 300); | |
} | |
let badStockPrice = function () { | |
iterator.next(price++); |
This file contains hidden or 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: 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; |
This file contains hidden or 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
let price = 10; | |
let stockPrice = function () { | |
setTimeout(function() { | |
iterator.next(price++); | |
}, 300); | |
} | |
let errorInStockPrice = function() { | |
setTimeout(function() { |
This file contains hidden or 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
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); | |
} |
This file contains hidden or 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
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!"); | |
} |