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
| # no pry in test environment but works otherwise | |
| class Binding | |
| def pry; nil; end | |
| def remote_pry; nil; end | |
| end | |
| __END__ | |
| for finding a bug sometimes i will try it out in the browser | |
| and set breakpoints in the code and javascript console |
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
| # Rakefile generated with | |
| # rails plugin new foo --mountable | |
| begin | |
| require 'bundler/setup' | |
| rescue LoadError | |
| puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | |
| end | |
| require 'rdoc/task' |
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
| require 'parser/current' | |
| require 'pp' | |
| require 'pry' | |
| require 'graph' | |
| module SexpLisper | |
| def self.parse(path) | |
| code = File.read(path) | |
| source_buffer = Parser::Source::Buffer.new(path, 1) |
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
| require 'parser/current' | |
| require 'pp' | |
| require 'rake' | |
| require 'pry' | |
| require 'treemap' | |
| require 'treemap/image_output' | |
| module SexpLisper | |
| def self.parse(path) | |
| code = File.read(path) |
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
| require 'parser/current' | |
| require 'pp' | |
| require 'rake' | |
| require 'pry' | |
| module SexpLisper | |
| def self.parse(path) | |
| code = File.read(path) | |
| source_buffer = Parser::Source::Buffer.new(path, 1) |
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
| require 'pp' | |
| require 'pry' | |
| require 'parser/current' | |
| require 'ruby-lint' | |
| require 'rake' | |
| # @!attribute [r] vm | |
| # @return [RubyLint::VirtualMachine] | |
| class Analysis < RubyLint::Iterator | |
| attr_reader :vm |
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
| #!/bin/bash | |
| # /usr/local/bin/pygmentize -f rtf -O "style=friendly,fontface=Courier Bold" "$1" | pbcopy | |
| # /usr/local/bin/pygmentize -l ruby -f rtf -P style=presentation -P fontface="Source Code Pro" "$1" | pbcopy | |
| /usr/local/bin/pygmentize -l ruby -f rtf -O "style=friendly,fontface=Source Code Pro" "$1" | | |
| # Set the font size to 36pt (that's the \fs72 - RTF font sizes work in doubles) | |
| sed "s/\\\\f0/\\\\f0\\\\fs72/g" | | |
| # And copy. Enjoy! |
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
| # find the parent module of a class | |
| # https://twitter.com/postmodern_mod3/status/410270060721082368 | |
| # using http://ruby-doc.org/core-2.0.0/Module.html#method-c-nesting | |
| # or else by parsing the string representation of the class name | |
| module Foo | |
| module Bar | |
| class MyClass | |
| def self.nesting | |
| Module.nesting |
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
| now = Time.now # => 2013-12-04 18:24:36 +0530 | |
| future = Time.now + 2.hours # => 2013-12-04 20:24:57 +0530 | |
| (now..future).member? now | |
| # TypeError: can't iterate from Time | |
| # from /usr/local/opt/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/core_ext/range/each.rb:21:in `ensure_iteration_allowed' |
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
| --- | |
| excludes: | |
| commit_msg: | |
| - change_id | |
| - release_note | |
| pre_commit: | |
| - causes_email | |
| - image_optimization | |
| - restricted_paths | |
| - test_history |