Skip to content

Instantly share code, notes, and snippets.

drinking coffee

Rafal Piekarski RaVbaker

drinking coffee
Block or report user

Report or block RaVbaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
RaVbaker / types.rb
Created Dec 11, 2017
Runtime type checking in Ruby - proof-of-concept
View types.rb
module Types
InvalidTypeError =
def specify(spec, a_method)
args_spec = []
return_spec = nil
case spec.first
when Hash
args_spec = spec.first.keys.first
RaVbaker / app_proxy.rb
Last active Jun 27, 2019
Simple HTTP app Proxy using sinatra
View app_proxy.rb
# ENDPOINT="" ruby app_proxy.rb
# curl -i localhost:4567/capture # => "<TIMEOUT>" or regular response every 2 calls
require 'sinatra'
require 'net/http'
$request_settings = { host: ENV["ENDPOINT"] }
$headers = { "Content-Type" => "application/json" }
$counter = 0

Keybase proof

I hereby claim:

  • I am ravbaker on github.
  • I am ravbaker ( on keybase.
  • I have a public key whose fingerprint is EE34 D7F4 AD3C 0C1C AAA1 23BA 98D3 D195 22C2 259E

To claim this, I am signing this object:

RaVbaker / initial_state_bug.rb
Last active Aug 29, 2015 — forked from Tuhaj/initial_state_bug.rb
Corrected version of initial repo by @Tuhaj
View initial_state_bug.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'activerecord', '4.2.1'
gem 'state_machines'
gem 'state_machines-activerecord'
gem 'sqlite3'
gem 'minitest'
RaVbaker / geocoder-service.js
Last active Aug 29, 2015 — forked from avaliani/geocoder-service.js
My solution is basically original with fixed bugs and removed dependency on underscore. :)
View geocoder-service.js
* An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of
* localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries
* Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`.
* @author: benmj
* @author: amir.valiani
* Original source:
RaVbaker / ar_instantiate_test.rb
Created May 14, 2014
AR.instantiate with hash when keys are symbols bug
View ar_instantiate_test.rb
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.1.1'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# This connection will do for database-independent bug reports.
RaVbaker /
Created Mar 16, 2014
Most changed files in your project - like @mfeathers suggested at #wrocloverb 2014 conference
find . -name "*.rb" |xargs -n1 -I file sh -c 'echo `git log --oneline file | wc -l`: file'|sort -nr |head
RaVbaker /
Created Nov 27, 2013
[iTerm] Naming tabs in iTerm
# A simple script which will name a tab in iTerm
# usage:
# $ nametab NewTabName
echo "trying to rename the current tab to $@"
echo -ne "\033]0;"$@"\007"
echo "finished"
RaVbaker /
Last active Oct 11, 2018
Reverse engineering Things SQLite tasks database

To open SQLite database run this command in

$ sqlite3 ~/Library/Containers/com.culturedcode.things/Data/Library/Application\ Support/Cultured\ Code/Things/ThingsLibrary.db

In SQLite command-line type this query to get your tasks stats:

sqlite> .mode column
sqlite> .header on
sqlite> select zscheduler, zstatus, ztrashed, count(*) from ZTHING where z_ent = 13 group by  zstatus,ztrashed order by Z_pk desc;
You can’t perform that action at this time.