Skip to content

Instantly share code, notes, and snippets.

@ProGM
ProGM / ac_streams_bench.rb
Last active June 8, 2022 19:46 — forked from palkan/ac_streams_bench.rb
ActionCable Streaming Benchmark
# rubocop disable:all
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
@ProGM
ProGM / main.rb
Last active June 19, 2017 10:09 — forked from coorasse/main.rb
CanCanCan Issue when compiling SQL using `accessible_by`
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '5.1.1' # use correct rails version

Convert a ruby hash to dotted path

def hash_to_dotted_path(hash, path = "")
  hash.each_with_object({}) do |(k, v), ret|
    key = path + k.to_s

    if v.is_a? Hash
      ret.merge! hash_to_dotted_path(v, key.to_s + ".")
 else
@ProGM
ProGM / Normalize.rb
Created January 26, 2016 14:36 — forked from agb91/Normalize.rb
normalizer for urls
require 'normalize_url'
require 'rubygems'
require 'httpclient'
require 'net/http'
require 'uri'
def printer(text, value)
puts text + ": " + value.to_s
end