Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| counter_reducer = -> (state, action) { | |
| state ||= 0 | |
| case action[:type] | |
| when 'increment' | |
| state += 1 | |
| when 'decrement' | |
| state -= 1 | |
| else | |
| state |
| WITH table_scans as ( | |
| SELECT relid, | |
| tables.idx_scan + tables.seq_scan as all_scans, | |
| ( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
| pg_relation_size(relid) as table_size | |
| FROM pg_stat_user_tables as tables | |
| ), | |
| all_writes as ( | |
| SELECT sum(writes) as total_writes | |
| FROM table_scans |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| #!/usr/bin/env ruby | |
| # http://guides.rubyonrails.org/v3.2.8/rails_on_rack.html | |
| require 'rack' | |
| require 'rails/all' | |
| # Defaults are defined in railties/lib/rails/application/default_middleware_stack.rb | |
| class Application < Rails::Application | |
| routes.draw do | |
| root to: Proc.new { [200, {'Content-Type' => 'text/html'}, ["Hello from app"]] } | |
| end |
| #!/usr/bin/env ruby | |
| require 'rails' | |
| # App definition | |
| class Application < Rails::Application | |
| end | |
| # Different application with directly defined routes that we can route to as well | |
| class DifferentApplication < Rails::Application | |
| routes.draw do |
| #!/usr/bin/env ruby | |
| # Extracted from traceroute gem + checking the presence of views as well | |
| require_relative './config/environment.rb' | |
| class Traceroute | |
| def initialize(app) | |
| @app = app | |
| end |
| #!/usr/bin/env ruby | |
| require 'rubydns' | |
| INTERFACES = [ | |
| [:udp, "0.0.0.0", 53], | |
| [:tcp, "0.0.0.0", 53] | |
| ] | |
| Name = Resolv::DNS::Name | |
| IN = Resolv::DNS::Resource::IN |
| # From Rakefile, expects :build task | |
| task :clean do | |
| `rm -rf pkg` | |
| end | |
| # Compare latest release with current git head | |
| require 'rubygems/comparator' | |
| task compare: [:clean, :build] do | |
| git_version = VagrantPlugins::Registration::VERSION |
| #!/usr/bin/ruby | |
| # Check what kind of spec data are saved in http://rubygems.org/Marshal.4.8.Z | |
| require 'rubygems' | |
| require 'pp' | |
| # wget http://rubygems.org/Marshal.4.8.Z if needed | |
| gems = Marshal.load(Gem.inflate(File.read("./Marshal.4.8.Z"))) | |
| SPEC_PARAMS = %w[ author authors name platform require_paths rubygems_version summary | |
| license licenses bindir cert_chain description email executables |
| From 3ee81e3239f4408c38f57b35344dbd424e7eab1d Mon Sep 17 00:00:00 2001 | |
| From: Josef Stribny <[email protected]> | |
| Date: Thu, 24 Oct 2013 14:48:46 +0200 | |
| Subject: [PATCH] Fix: Rename searchindex.rhtml file | |
| --- | |
| lib/rdoc/generator/template/sdoc/search_index.rhtml | 8 ++++++++ | |
| lib/rdoc/generator/template/sdoc/searchindex.rhtml | 8 -------- | |
| 2 files changed, 8 insertions(+), 8 deletions(-) | |
| create mode 100644 lib/rdoc/generator/template/sdoc/search_index.rhtml |