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
| Rails.application.routes.recognize_path('/api/path/to') |
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
| ::ActiveSupport::Notifications.subscribe('sql.active_record') do |_, _, _, _, payload| | |
| puts " == Query : #{payload[:sql]}" | |
| puts " == Caller: #{caller.reject{|x|x.include?('/gems/')||x.include?('/lib/ruby/')}.join("\n")}" | |
| puts | |
| 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
| linking miniruby | |
| generating encdb.h | |
| ./miniruby: [BUG] Segmentation fault at 0x0000000000060ee0 | |
| ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux-musl] | |
| -- Control frame information ----------------------------------------------- | |
| c:0001 p:0000 s:0003 E:000e10 (none) [FINISH] | |
| -- Machine register context ------------------------------------------------ |
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
| # This code is licensed from CircleCI to the user under the MIT license. See | |
| # https://circleci.com/orbs/registry/licensing for details. | |
| commands: | |
| hello-triggerer: | |
| parameters: | |
| to: | |
| default: ${CIRCLE_USERNAME} | |
| type: string | |
| steps: | |
| - run: echo "Hello << parameters.to >>" |
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
| # Code mostly adapted from original by Jesus: https://www.ruby-forum.com/t/extract-numbers-from-string/115434/5 | |
| require 'benchmark' | |
| n = 100_000 | |
| header = 't=1570633834.463123' | |
| Benchmark.bmbm do |x| | |
| x.report('scan') do | |
| n.times {header.scan(/\d/).join} |
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
| module Wrapper | |
| InstanceMethods = Module.new | |
| def self.for(klass, accessor_name: nil) | |
| InstanceMethods.module_eval do | |
| define_method :initialize do |object| | |
| raise TypeError, "not a #{klass}" unless object.is_a?(klass) | |
| @object = object | |
| 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
| module Datadog | |
| module Profiling | |
| # Starts the profiler, if the profiler is supported by in | |
| # this runtime environment and if the profiler has been enabled | |
| # in configuration. | |
| # | |
| # @return [Boolean] `true` if the profiler has successfully started, otherwise `false`. | |
| # @public_api | |
| def self.start | |
| return false unless Datadog.send(:components).profiler |
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 'faraday' | |
| require 'json' | |
| def fetch_data(search_query) | |
| response = [:just_started_sentinel] | |
| list = [] | |
| page = 1 | |
| until response.empty? do | |
| sleep 0.11 # 10 request/sec is the remote rate limit |
OlderNewer