Skip to content

Instantly share code, notes, and snippets.

Pan Thomakos panthomakos

Block or report user

Report or block panthomakos

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
@panthomakos
panthomakos / Gemfile
Created Aug 8, 2019
suggest-typed and todo hang
View Gemfile
gem 'sorbet'
@panthomakos
panthomakos / Gemfile
Created Jan 10, 2017
Hanami Model Primary Key Exception
View Gemfile
source 'https://rubygems.org'
gem 'sqlite3'
gem 'hanami-model'
@panthomakos
panthomakos / Gemfile
Created Dec 13, 2016
mapping (Hanami::Model::Error)
View Gemfile
source 'https://rubygems.org'
gem 'sqlite3'
gem 'hanami-model'
View keybase.md

Keybase proof

I hereby claim:

  • I am panthomakos on github.
  • I am pan (https://keybase.io/pan) on keybase.
  • I have a public key whose fingerprint is A2C6 17A6 4D65 2854 1240 7843 39F8 C7AA 10D9 15ED

To claim this, I am signing this object:

@panthomakos
panthomakos / Gemfile
Created Oct 18, 2012
Guard-Yard Example
View Gemfile
source "http://rubygems.org"
gem 'guard-yard'
gem 'rb-fsevent', :require => false
@panthomakos
panthomakos / benchmark.rb
Created May 3, 2012
Benchmark Your Bundle
View benchmark.rb
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]
@panthomakos
panthomakos / benchmark.rb
Created Mar 12, 2012
Rails ActiveSupport::Autoload Benchmark
View benchmark.rb
# Rails 3.2 @ d5d241cb2c696f13e2c16efca0d24565a6e1c0a5
require 'active_support/dependencies/autoload'
require 'benchmark'
GC.disable
FILES = (1..1_000_000).map do |file|
["Base#{file}".to_sym, "base/#{file}"]
end
@panthomakos
panthomakos / gil.rb
Created Feb 5, 2012
Ruby - Threading and the GIL
View gil.rb
require 'benchmark'
require 'mysql2'
x = Mysql2::Client.new
y = Mysql2::Client.new
Benchmark.bm do |b|
b.report('w/o') do
x.query("SELECT SLEEP(1)")
y.query("SELECT SLEEP(1)")
@panthomakos
panthomakos / user_presenter_spec.rb
Created Jan 26, 2012
Simplified Version of user_presenter_spec.rb from DestroyAllSoftware
View user_presenter_spec.rb
class Module
alias :let :define_method
end
UserPresenter = Struct.new(:user) do
let(:full_name){ [user.first_name, user.last_name].join(' ') }
end
describe UserPresenter do
let(:user){ stub(:user, :first_name => 'Bob', :last_name => 'Smith') }
@panthomakos
panthomakos / group.rb
Created Sep 20, 2011
Improved Custom Error Messages in Ruby
View group.rb
class Group
module Error
class Standard < StandardError; end
class AlreadyAMember < Standard; end
class NotPermittedToJoin < Standard; end
end
def join user
raise Error::NotPermittedToJoin unless self.permitted?(user)
raise Error::AlreadyAMember if self.member?(user)
You can’t perform that action at this time.