Skip to content

Instantly share code, notes, and snippets.

Christos Zisopoulos christos

Block or report user

Report or block christos

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
View gist:20534
class ActiveRecord::Base
@@cache_store = nil
def self.cache_store
@@cache_store ||= ActionController::Base.cache_store
end
def self.caches(method_name, key = nil, options = {}, &block)
if key.is_a?(Hash)
options = key
key = nil
@christos
christos / gist:34336
Created Dec 10, 2008
Cucumber + Selenium
View gist:34336
#
# cucumber.yml
#
# Filter which features are run with each profile by the file extension
webrat: --require features/steps/common --require features/support/webrat_env.rb --exclude selenium.feature --format progress
selenium: --require features/steps/common --require features/support/selenium_env.rb --exclude webrat.feature --format progress
#
# features/support/env.rb
View gist:34744
#
# cucumber.yml
#
# Filter which features are run with each profile by the file extension
webrat: --require features/steps/common --require features/support/webrat_env.rb --exclude selenium.feature --format progress
selenium: --require features/steps/common --require features/support/selenium_env.rb --exclude webrat.feature --format progress
#
# features/support/env.rb
View gist:39038
#
# cucumber.yml
#
# Filter which features are run with each profile by the file extension
webrat: --require features/steps/common --require features/support/webrat_env.rb --exclude selenium.feature --format progress
selenium: --require features/steps/common --require features/support/selenium_env.rb --exclude webrat.feature --format progress
#
# features/support/env.rb
View gist:128670
# mailer_twitterable/lib/supercoco9/mailer_twitterable.rb
module Supercoco9
module MailerTwitterable
def self.included(base)
base.extend ClassMethods
base.include InstanceMethods
end
module ClassMethods
def deliver_with_twitterable!(mail=@mail)
# ... your code here
View Books wishlist
http://oreilly.com/catalog/9780596521264/
http://oreilly.com/catalog/9780596523008/
http://oreilly.com/catalog/9780596529260/
http://pragprog.com/titles/ahptl/pragmatic-thinking-and-learning
http://pragprog.com/titles/ppmetr/metaprogramming-ruby
http://savethepixel.org
http://www.amazon.co.uk/Code-Generation-Action-Jack-Herrington/dp/1930110979
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
http://www.amazon.com/Defensive-Design-Web-improve-messages/dp/073571410X
http://www.amazon.com/Design-Patterns-Ruby-Addison-Wesley-Professional/dp/0321490452
@christos
christos / remotable.jquery132.js
Created Jan 17, 2010
Example remotable.js for Protytpe 1.6 and jQuery 1.3.2 with livequery
View remotable.jquery132.js
jQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");}
});
$('a[data-remote="true"]').live('click', function(e) {
var $link = $(this);
var method = $link.attr('data-method') || 'get';
var url = $link.attr('href');
var type = (method == 'get') ? 'GET' : 'POST';
View asset_expansions.rb
ActionView::Helpers::AssetTagHelper.register_javascript_expansion({
html5shiv: "http://html5shiv.googlecode.com/svn/trunk/html5.js",
ie7js: "http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js",
ie8js: "http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js",
jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"
})
View gist:409518
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@christos
christos / gist:459765
Created Jul 1, 2010 — forked from defunkt/gist:132456
Bash snippet to open new shells in most recently visited dir.
View gist:459765
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
\cd
else
You can’t perform that action at this time.