Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am icem on github.
  • I am icem (https://keybase.io/icem) on keybase.
  • I have a public key ASCbIsYllTjQJwMjCOyNEwyvwl3H8P8AcRASzBgEnTkzYQo

To claim this, I am signing this object:

chmod +x git-hooks/pending_migrations_check.rb
cd .git/hooks
ln -is ../../git-hooks/pending_migrations_check.rb post-merge
ln -is ../../git-hooks/pending_migrations_check.rb post-checkout
@icem
icem / readonly_model.rb
Created June 1, 2013 11:30
Forbid model from get saved or destroyed in Ruby on Rails
module Util::ReadonlyModel
extend ActiveSupport::Concern
included do
before_destroy :raise_readonly
end
def readonly?
true
end
# Script for testing disk drive
# Usage: ruby random_stream_test.rb filepath [ size ]
FILENAME = ARGV.first
n = ARGV.last.to_i || 1000
puts "Start writing #{n} lines to file '#{FILENAME}'..."
File.open(FILENAME, "w") do |file|
n.times do
str = ''
100000.times { str << 97 + rand(26) } #Generation long random string