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
| BERTRPC::Service.new("localhost", 9999).call.ernie.echo(2282389) |
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 'rubygems' | |
| require 'activesupport' | |
| require 'benchmark' | |
| include Benchmark | |
| class T | |
| attr_accessor :date, :count | |
| def initialize(_date,_count) | |
| @count = _count | |
| @date = _date |
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
| include Test::Unit::Assertions | |
| #=> Object | |
| m = method(:assert_in_delta) | |
| #=> #<Method: Object(MiniTest::Assertions)#assert_in_delta> | |
| m.methods - Object.methods | |
| #=> [:call, :[], :arity, :to_proc, :receiver, :owner, :unbind, :source_location, :parameters] | |
| m.parameters | |
| #=> [[:req, :exp], [:req, :act], [:opt, :delta], [:opt, :msg]] | |
| m.arity | |
| #=> -3 |
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
| if defined?(Footnotes) && Rails.env.development? | |
| Footnotes.run! | |
| Footnotes::Filter.notes -= [:cookies, :session] | |
| Footnotes::Notes::AssignsNote.ignored_assigns += [:@_view_renderer, :@_response_body, :@_routes, :@_view_context_class] | |
| 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
| require 'benchmark' | |
| def is_it_true? | |
| true | |
| end | |
| CONSTANT = 1 | |
| BenchTimes = 1_000_000 | |
| Benchmark.bm(20) do |bm| |
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
| # Dirty monkey patch to globally disable certificate validation | |
| # YOU SHOULD NEVER USE THIS | |
| # Except when testing/debugging with self signed certificates | |
| require 'net/http' | |
| module OpenSSL | |
| module SSL | |
| VERIFY_PEER = VERIFY_NONE | |
| 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
| # VAlidate Part Of Resource | |
| module Vapor | |
| extend ActiveSupport::Concern | |
| included do | |
| class_attribute :target_name, :attribute_names | |
| include ActiveModel::Validations | |
| include ActiveModel::Conversion | |
| include ActiveModel::Naming | |
| 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
| class ActiveSupport::BufferedLogger | |
| # Print a logger.debug line with colored Name | |
| # If the msg is not a string, it will inspect it | |
| # Pass it a block to record the time_taken to yield it | |
| # Symbols in the msg like :method will be interpolated with block_result.send(:method) | |
| # eg: fancy_debug("Find Users", "Found :count users") { User.where() } | |
| def fancy_debug(name, msg = '', &block) | |
| if block_given? | |
| start_time = Time.now | |
| result = yield |
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
| inline(:C) do |builder| | |
| builder.c " | |
| VALUE c_unpack_l(char *bytes) { | |
| uint32_t tmp; | |
| memcpy(&tmp, bytes, sizeof(uint32_t)); | |
| return INT2NUM(tmp); | |
| }" | |
| builder.c " | |
| VALUE c_unpack_s(char *bytes) { | |
| uint16_t tmp; |
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
| > nanoc deploy --target default | |
| Captain! We’ve been hit! | |
| === MESSAGE: | |
| LoadError: cannot load such file -- fog | |
| === COMPILATION STACK: |