Skip to content

Instantly share code, notes, and snippets.

View kpumuk's full-sized avatar

Dmytro Shteflyuk kpumuk

View GitHub Profile
@kpumuk
kpumuk / mysql_xtradb.patch
Created April 20, 2010 08:02
Patch for the Homebrew's mysql formula to build it with Percona XtraDB plugin
diff --git a/Library/Formula/mysql.rb b/Library/Formula/mysql.rb
index 1f2ecdc..b6f3c01 100644
--- a/Library/Formula/mysql.rb
+++ b/Library/Formula/mysql.rb
@@ -1,5 +1,11 @@
require 'formula'
+class PerconaXtradb < Formula
+ url 'http://www.percona.com/percona-builds/Percona-Server/Percona-Server-5.1.45-10/source/percona-xtradb-1.0.6-10.tar.gz'
+ md5 'd20bc3befd6e732c40fd41a9adcec9d9'
@kpumuk
kpumuk / Rakefile
Created March 16, 2010 14:21
Completely override rake task (and dismiss it's actions and prerequisites)
task :hello do
puts 'hello'
end
Rake.application[:hello].clear
task :hello do
puts 'hello, world'
end
@kpumuk
kpumuk / Rakefile
Created March 16, 2010 14:16
Perform some actions before the rake task execution (something like "before" action)
task :hello do
puts 'hello'
end
task :before do
puts 'before all'
end
task :hello => :before
@kpumuk
kpumuk / Rakefile
Created March 16, 2010 14:11
Append some actions to an existing Rake task (something like "after" action)
task :hello do
puts 'hello'
end
task :hello do
puts 'world!'
end
def from_russia?
if MAXMIND_GEOIP_DB
info = MAXMIND_GEOIP_DB.look_up(ip_address) || {}
info[:country_code].to_s.upcase == 'RU'
else
false
end
end
# == Schema Information
# Schema version: 20090420101231
#
# Table name: loop_locks
#
# entity_id :integer(4) not null
# loop :string(255) not null
# created_at :datetime not null
# timeout_at :datetime not null
#
class Module
def name_finder(*methods)
methods.each do |method|
raise TypeError.new("method name is not symbol") unless method.is_a?(Symbol)
metaclass = class << self; self; end
metaclass.send(:define_method, method) do
instance_variable_get(self.find_by_name(method.to_s))
end
end
end
Feature: User login
In order to use application
As a user
I want to be able to login and logout from the application
Scenario: Access restricted to an anonymous user
Given Anonymous user
When I go to the home page
Then I should be on the login page
Feature: Nagios
In order stop SMS flood in case of emergency
As an admin
I want to be able to enable or disable SMS notifications
Scenario: Disable SMS notifications
Given Nagios SMS notifications enabled
And I am logged in as an admin user
When I go to the path "/nagios"
And I press "Disable"
@kpumuk
kpumuk / deploy.rb
Created November 18, 2009 10:03
Using bundled Jammit to precache assets in deploy.rb
namespace :deploy do
desc 'Bundle and minify the JS and CSS files'
task :precache_assets, :roles => :app do
root_path = File.expand_path(File.dirname(__FILE__) + '/..')
jammit_path = Dir["#{root_path}/vendor/gems/jammit-*/bin/jammit"].first
yui_lib_path = Dir["#{root_path}/vendor/gems/yui-compressor-*/lib"].first
assets_path = "#{root_path}/public/assets"
# Precaching assets
run_locally "ruby -I#{yui_lib_path} #{jammit_path}"