This is how I debug SystemStackError when there is no stack trace.
My first attempt was:
begin
a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
puts caller
end| # Install Virtualbox from Homebrew (or download and install manually https://www.virtualbox.org/wiki/Downloads) | |
| brew cask install virtualbox | |
| # Install Docker | |
| brew install docker docker-machine docker-compose | |
| # Create your VM | |
| docker-machine create -d virtualbox default --virtualbox-cpu-count "2" --virtualbox-cpu-memory "4096" | |
| docker-machine start |
This is how I debug SystemStackError when there is no stack trace.
My first attempt was:
begin
a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
puts caller
end| require 'resque/errors' | |
| class DatabaseBackupJob | |
| def self.perform(id, foo, bar) | |
| # do backup work | |
| rescue Resque::TermException | |
| # write failure to database | |
| # re-enqueue the job so the job won't be lost when scaling down. | |
| Resque.enqueue(DatabaseBackupJob, id, foo, bar) |
Dear Rubyists,
I just lost a contract because of my code in a Rails project.
The specific code in question is related to a "posting a comment" feature. Here are the details:
In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.
The "senior developer", whom is the stake holder's right hand man, said this:
Drink recipes are subjective. Experimentation is a lot of fun, and quite frankly encouraged. However, you really should know what the fuck you're doing before you go all willy nilly throwing everything in your kitchen into a glass and calling it a cocktail. This is the classic Mojito. It's damn fine on it's own. In fact, this is the only way I drink them. Once you've mastered this technique, feel free to experiment with other stuff like mangoes or pineapple or whatever. Just, please, don't call your franken-drink a Mojito.
| require "money" | |
| class Decorator < BasicObject | |
| undef_method :== | |
| def initialize(component) | |
| @component = component | |
| end | |
| def method_missing(name, *args, &block) |
| Moved to README within Vim Environment repo | |
| http://github.com/actaneon/VimEnv/blob/master/README |
| list untracked, unignored files: git ls-files -o --exclude-standard | |
| unstage: git reset HEAD FILE | |
| unstage and undo local: git reset --hard HEAD FILE | |
| undo unstaged file: git checkout -- FILE | |
| undo commit with using new commit: git revert [HEAD|$id] | |
| update last commit to include missed adds: git commit --amend (after git add FILE) | |
| git push origin :branch #remove remote | |
| git remote prune origin |