Skip to content

Instantly share code, notes, and snippets.

View aokon's full-sized avatar

Adam Okoń aokon

  • Elegant Code
  • Gdańsk/Poland
View GitHub Profile
@aokon
aokon / gist:1710953
Created January 31, 2012 15:06 — forked from travis/gist:1084767
testing facebook connect with capybara and rspec
require 'mogli'
module FacebookIntegrationHelpers
shared_context "with unconnected facebook user" do
let(:fb_user) { create_test_user(installed: false) }
after { fb_user.destroy }
end
def app_client
Mogli::AppClient.new(AppConfig.facebook.access_token, AppConfig.facebook.app_id)
@aokon
aokon / haproxy.cnf
Created September 28, 2011 07:46 — forked from xeron/haproxy.cnf
haproxy.cnf
global
log 127.0.0.1 local0
log 127.0.0.1 local0 notice
maxconn 4096
nbproc 1
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
@aokon
aokon / gist:1225564
Created September 18, 2011 21:23
git repo and redmine
In Settings/Repository section choose git on the list and set path to the repo.
Fetch chansets
rails runner "Repository.fetch_changesets" -e production
More info see at http://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages
@aokon
aokon / gist:1042307
Created June 23, 2011 10:17 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@aokon
aokon / snippet.rb
Created February 10, 2011 10:52 — forked from teamon/snippet.rb
require 'iconv'
class String
def to_permalink
Iconv.iconv('ascii//translit//IGNORE', 'utf-8', self).first.gsub("'", "").gsub(/[^\x00-\x7F]+/, '').gsub(/[^a-zA-Z0-9-]+/, '-').gsub(/^-/, '').gsub(/-$/, '').downcase
end
end