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
@current
Scenario: Forgot Password # features/plain/authentication.feature:41
Given I am a verified user "rick@example.net" / "password" on the process server "Big Process Server" # features/step_definitions/user_steps.rb:15
And I am on the home page # features/step_definitions/web_steps.rb:14
When I follow "Forgot Password?" # features/step_definitions/web_steps.rb:26
Then I should be on the forgot password page # features/step_definitions/web_steps.rb:255
When I fill in "password_email" with "rick@example.net" # features/step_definitions/web_steps.rb:35
And I press "Reset Password" #
@kirkconnell
kirkconnell / conten_ui_log.rb
Created April 29, 2011 23:55
Get content_ui for log
#return an array of arrays for the act event logger track changes in content_ui fields
# [ profile content real name, "displayed field name: displayed field value"]
def content_x_log_array
content_ui_log_instructions = (1..20).map {|n| ["content_#{n}", lambda{|value| "#{get_display_name(n)} : #{value}" }}
end
def get_display_name(n)
if template_group.present? && ci = template_group.content_uis.find_by_generic_field_number(n)
ci.field_name.titleize.gsub(/\s+/, '').underscore.to_sym
end
#return an array of arrays for the act event logger track changes in content_ui fields
# [ profile content real name, "displayed field name: displayed field value"]
def content_x_log_array
content_ui_log_instructions = (1..20).map {|n| ["content_#{n}", lambda{|value| "#{get_display_name(n)} : #{value}" }}
end
def get_display_name(n)
if template_group.present? && ci = template_group.content_uis.find{|ci| c.generic_field_number == n}
ci.field_name.titleize.gsub(/\s+/, '').underscore.to_sym
end
@kirkconnell
kirkconnell / gist:957552
Created May 5, 2011 18:07
Query for SNPS comparisons
SELECT
e.id,
e.company_name,
l.url_for AS location,
sn_entities.location_id,
sn_entities.sn_price,
ps_entities.ps_price,
p.monthly_price AS snps_price
FROM
entities e INNER JOIN
var mousingOverEvent;
var mouseOutDelay = 500;
$('.hover_menu').hover(function(){
clearTimeout(mousingOverEvent);
$('#passport_login').hide();
$('#passport_dropdown').show();
$('#passport_dropdown').position({
my: "right top",
at: "right bottom",
of: "#switch_apps a",
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
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"
@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
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: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