layout | title | date | comments | categories | |||
---|---|---|---|---|---|---|---|
post |
Ruby Hacking Guide ch. 11: Finite-state scanner |
2013-04-01 02:19 |
true |
|
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
/Users/markburns/code/delfos/lib/delfos/call_stack.rb:18: [BUG] Segmentation fault at 0x00000000000038 | |
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin14] | |
-- Crash Report log information -------------------------------------------- | |
See Crash Report log file under the one of following: | |
* ~/Library/Logs/CrashReporter | |
* /Library/Logs/CrashReporter | |
* ~/Library/Logs/DiagnosticReports | |
* /Library/Logs/DiagnosticReports | |
for more details. |
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
def show_class_instance_variables(n) | |
puts "#{n} #{n.instance_variables}" if n.instance_variables.length.positive? | |
return unless (n.is_a?(Class) || n.is_a?(Module)) | |
n.constants.each do |c| | |
next if n==c | |
klass = n.const_get(c) | |
if klass.is_a?(Class) || klass.is_a?(Module) |
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
module DomainConcepts | |
def self.prepended(base) | |
base.class_eval do | |
before_action :set_view_paths | |
end | |
end | |
%i(index show edit new).each do |a| | |
define_method a do | |
super() |
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
Process: ruby [82556] | |
Path: /Users/USER/*/ruby | |
Identifier: ruby | |
Version: 0 | |
Code Type: X86-64 (Native) | |
Parent Process: zsh [64346] | |
Responsible: iTerm2 [632] | |
User ID: 501 | |
Date/Time: 2016-10-11 05:57:48.373 +0100 |
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
require "binding_of_caller" | |
class BasicObject | |
def dbg(variable_name=nil) | |
puts ">" * 80 | |
other_binding = binding.of_caller(1) | |
vars = | |
other_binding.eval("local_variables") + | |
other_binding.eval("instance_variables") |
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
require 'faraday' | |
require 'faraday_middleware' | |
require 'byebug' | |
def connection | |
@connection ||= | |
Faraday::Connection.new 'http://www.letsrevolutionizetesting.com/' do |c| | |
c.request :json | |
c.response :json, :content_type => /\bjson$/ |
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
module I15r; end | |
module Visitable | |
def accept(visitor) | |
visitor.send visitor_method_name, self | |
end | |
def visitor_method_name | |
"visit_#{self.class.name}".gsub(/::/, "__") | |
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
editor = ENV['EDITOR'] | |
mapping = { | |
[:textmate, :txmt, :tm] => :textmate, | |
[:sublime, :subl, :st] => :sublime, | |
[:macvim, :mvim, :vim] => :macvim | |
} | |
mapping.each do |matches, value| | |
matches.each do |m| |
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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: OpenPGP.js v.1.20130820 | |
Comment: http://openpgpjs.org | |
xo0EUhkGSQEEAIzpd6WBTyNt7wdBenr6Dj9eDnyRRCsy/n6TO7ow1SOT6h+k | |
t+p8MvYO2G+TprApJeIiFlZPCA6RdP2FPhQePyBSbf3VRrDDlojmRXOs+iWr | |
yzT1CGrnkkc46wKque6c4BXtz2dVb+y1TSQfn8BaKTfY8pvrj9agbOPCaE2C | |
gMt1ABEBAAHNJ01hcmsgQnVybnMgPG1hcmt0aGVkZXZlbG9wZXJAZ21haWwu | |
Y29tPsKcBBABCAAQBQJSGQZKCRCf0oceVRzIIQAASRYEAIdxD0oOrjRWRDbi | |
NESuwAJG6vJtNdaQ1HLTZixDmUWPlHHcRuxzxg/mU+BPQUGdA29xck54dBsr |