Skip to content

Instantly share code, notes, and snippets.

View martinrehfeld's full-sized avatar

Martin Rehfeld martinrehfeld

View GitHub Profile
@martinrehfeld
martinrehfeld / patiently.rb
Created June 10, 2010 20:51 — forked from langalex/patiently.rb
retry wrapper for cucumber steps
def patiently(&block)
cycles = 0
begin
yield
rescue => e
cycles += 1
sleep 0.1
if cycles < 10
retry
else
@martinrehfeld
martinrehfeld / gist:395331
Created May 9, 2010 18:29 — forked from jamesgolick/gist:345040
Syntax highlighting for Ruby code (webby helper)
require 'syntax/convertors/html'
require 'uv'
module Code
BACKGROUND_COLOR = '#2B2B2B'
COLOR = '#E6E1DC'
COLORS = {
:keyword => '#CC7833',
:symbol => '#6E9CBE',
:constant => '#DA4939',
module RackHeaderHack
def set_headers(headers)
driver = page.driver
def driver.env
@env.merge(super)
end
def driver.env=(env)
@env = env
end
driver.env = headers
{
"twitter" : "klickmich",
"github" : "martinrehfeld",
"blog" : "http://inside.glnetworks.de",
"email" : "martin.rehfeld@glnetworks.de",
"location" : "Germany/Berlin"
}
@martinrehfeld
martinrehfeld / philerity_env.rb
Created March 5, 2010 08:41 — forked from phillipkoebbe/philerity_env.rb
optimized ENV for Culerity
require 'culerity'
$env_javascript_tag = ENV['CULERITY_JAVASCRIPT_TAG'] || '@javascript'
def set_jruby_env
rvm_jruby = ENV['CULERITY_RVM_JRUBY'] || 'jruby'
info = `rvm info #{rvm_jruby}`
gem_home = info =~ /GEM_HOME:\s?"([^"]*)"/ ? $1 : ''
gem_path = info =~ /GEM_PATH:\s?"([^"]*)"/ ? $1 : ''
my_ruby_home = info =~ /MY_RUBY_HOME:\s?"([^"]*)"/ ? $1 : ''
/*
* CPBundle.sj
* AppKit
*
* Created by Nicholas Small.
* Copyright 2009, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@martinrehfeld
martinrehfeld / gist:62257
Created February 11, 2009 20:50
Diff-howto on belongs_to associations with Ext Scaffold Generator
diff --git a/app/controllers/non_namespaced_post_resources_controller.rb b/app/controllers/non_namespaced_post_resources_controller.rb
index 1c0d143..0dc0b74 100644
--- a/app/controllers/non_namespaced_post_resources_controller.rb
+++ b/app/controllers/non_namespaced_post_resources_controller.rb
@@ -12,7 +12,7 @@ class NonNamespacedPostResourcesController < ApplicationController
def index
respond_to do |format|
format.html # index.html.erb (no data required)
- format.ext_json { render :json => find_non_namespaced_post_resources.to_ext_json(:class => NonNamespacedPostResource, :count => NonNamespacedPostResource.count(options_from_search(NonNamespacedPostResource))) }
+ format.ext_json { render :json => find_non_namespaced_post_resources.to_ext_json(:methods => :author_name, :class => NonNamespacedPostResource, :count => NonNamespacedPostResource.count(options_from_search(NonNamespacedPostResource))) }