Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View RaVbaker's full-sized avatar
drinking coffee

Rafal Piekarski RaVbaker

drinking coffee
View GitHub Profile
@RaVbaker
RaVbaker / README.md
Last active February 3, 2019 18:04 — forked from mchelen/README.md
JSON Resume sample
@RaVbaker
RaVbaker / types.rb
Created December 11, 2017 09:59
Runtime type checking in Ruby - proof-of-concept
module Types
InvalidTypeError = Class.new(ArgumentError)
def specify(spec, a_method)
args_spec = []
return_spec = nil
case spec.first
when Hash
args_spec = spec.first.keys.first
@RaVbaker
RaVbaker / app_proxy.rb
Last active July 20, 2020 08:55
Simple HTTP app Proxy using sinatra
# ENDPOINT="host.com" 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 (https://keybase.io/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
RaVbaker / initial_state_bug.rb
Last active August 29, 2015 14:19 — forked from Tuhaj/initial_state_bug.rb
Corrected version of initial repo by @Tuhaj
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'activerecord', '4.2.1'
gem 'state_machines'
gem 'state_machines-activerecord'
gem 'sqlite3'
gem 'minitest'
GEMFILE
@RaVbaker
RaVbaker / geocoder-service.js
Last active August 29, 2015 14:07 — forked from avaliani/geocoder-service.js
My solution is basically original with fixed bugs and removed dependency on underscore. :)
/*
* 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: https://gist.github.com/benmj/6380466
*/
@RaVbaker
RaVbaker / ar_instantiate_test.rb
Created May 14, 2014 10:33
AR.instantiate with hash when keys are symbols bug
# 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
RaVbaker / your_legacy_code.sh
Created March 16, 2014 14:10
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
RaVbaker / nametab.sh
Created November 27, 2013 12:57
[iTerm] Naming tabs in iTerm
#!/bin/bash
# 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
RaVbaker / readme.md
Last active November 29, 2023 06:08
Reverse engineering Things SQLite tasks database

To open SQLite Things.app database run this command in Terminal.app:

$ 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;

ZSCHEDULER ZSTATUS ZTRASHED count(*)