Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>untitled</title>
</head>
@ogredude
ogredude / custom_glue.module
Created August 6, 2012 17:13
How to include your glue module's CSS last
/**
* Of course, custom_glue is the name of the module. Substitute your own module's name.
*/
/**
* Preprocess the wrapping HTML.
*
* @param array &$variables
* Template variables.
*/
$tid = 1;
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if(array_key_exists('und', $node->field_department)) {
$tid = $node->field_department['und'][0]['tid'];
}
}
return $tid;
<?php
$view = new view;
$view->name = 'userthing';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'userthing';
$view->core = 7;
$view->api_version = '3.0';
./automysqlbackup/automysqlbackup: line 835: 6: Bad file descriptor
./automysqlbackup/automysqlbackup: line 836: 7: Bad file descriptor
Feature: Offer Notifications
Background:
Given there are the following users:
| email |
| bob@mythingy.com |
| alice@mythingy.com |
Given a clear email queue
And "alice@mythingy.com" has created an Offer:
@ogredude
ogredude / application_controller.rb
Created March 12, 2012 19:03
Spec fails, expected response to be a <:redirect> but was <200>. Trying to fetch from browser, we clearly see a redirect request in the server log. WTF?
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :find_states
helper_method :current_user
rescue_from CanCan::AccessDenied do |exception|
flash[:error] = exception.message
redirect_to root_url
end
module Helpers
def sign_in(user)
@user_session = UserSession.create user
end
def fill_in_autocomplete(selector, value)
page.execute_script %Q{$('#{selector}').val('#{value}').keydown()}
end
def choose_autocomplete(text)
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'spork', :test_unit => false, :cucumber => true, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')