Skip to content

Instantly share code, notes, and snippets.

View kirkconnell's full-sized avatar

Carlos Kirkconnell kirkconnell

  • Google
  • Mountain View, CA
View GitHub Profile
Scenario: International Lead
#Given I am on the home page
#When I follow "International" within the footer
#Then I should be on the international page
Given I am on the international page
When I follow "Germany"
Then I should be on the "Germany" international directory page
And the spam-protected "Country" field should contain "Germany"
When I fill out the spam-protected form within the "main body" section following these instructions:
| action | name | value |
module ContentUI
module Presenters
class Short < ContentUI::Presenters::Base
def render_body
@template.content_tag :div, :class => "float_left" do
@form.text_field @template.content_field_name(self), "data-max-chars" => self.max_length
end
end
end
end
@kirkconnell
kirkconnell / gist:1452571
Created December 9, 2011 17:48
app/views/template_groups/_form.html.haml
.large_break
.two_col_left
-form_for @template_group, :url => template_group_form_url, :method => template_group_form_method do |f|
%fieldset#template_group
%legend Template Groupd Details
=f.label :name
=f.text_field :name
%br
@kirkconnell
kirkconnell / Japanese style
Created December 6, 2011 22:25 — forked from endolith/Has weird right-to-left characters.txt
Unicode smileys emoticons
⨀_⨀
⨂_⨂
(/◔ ◡ ◔)/
°ﺑ°
(¬_¬)
(´・ω・`)
(ʘ_ʘ)
(ʘ‿ʘ)
(๏̯͡๏ )
(◕_◕)
class LocationData::Profiles < ActiveResource::Base
self.schema = Front::PROFILE_SCHEMA
def method_missing(name, *args, &block)
super(name, *args, &block)
rescue NoMethodError, NameError => e
if name.to_s =~ /^(?:county|state|provincial)_profiles$/
[]
else
raise e
@kirkconnell
kirkconnell / gist:1230523
Created September 20, 2011 21:53
CanCan spec error.
Failures:
1) CanCan::ModelAdapters::ActiveRecordAdapter should fetch only associated records when using with a scope for conditions
Failure/Error: category1.articles.accessible_by(@ability).should == [article1]
expected: [#<Article id: 1, name: nil, published: nil, secret: true, priority: nil, category_id: 1>],
got: [] (using ==)
Diff:
@@ -1,2 +1,2 @@
-[#<Article id: 1, name: nil, published: nil, secret: true, priority: nil, category_id: 1>]
+[]
# ./spec/cancan/model_adapters/active_record_adapter_spec.rb:139
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
@kirkconnell
kirkconnell / gist:1023353
Created June 13, 2011 18:18
last lines of my httpd.conf
# Language settings
Include /private/etc/apache2/extra/httpd-languages.conf
# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include /private/etc/apache2/extra/httpd-info.conf
# Virtual hosts
namespace :locations do
desc 'Update the population field of all city locations with the help of a csv file'
task :populate_cities, :pop_file, :no_match_file, :needs => :environment do | t , args |
raise "Please send a valid CSV File, example: rake locations:populate_cities[pathCVSFile,noMatchFilePath*]" if args[:pop_file].nil?
csv_file = args[:pop_file]
unmatch_file = args[:no_match_file] || "no_match_location.csv"
namespace :pinow do
desc 'Update the population field of all city locations with the help of a csv file'
task :populate_cities => :environment do
require 'fastercsv'
#constants
CODE = 0
NAME = 5
STATE_NAME = 6