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
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 / Japanese style
Created December 6, 2011 22:25 — forked from endolith/Has weird right-to-left characters.txt
Unicode smileys emoticons
⨀_⨀
⨂_⨂
(/◔ ◡ ◔)/
°ﺑ°
(¬_¬)
(´・ω・`)
(ʘ_ʘ)
(ʘ‿ʘ)
(๏̯͡๏ )
(◕_◕)
@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
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
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 |
@kirkconnell
kirkconnell / gist:1879458
Created February 21, 2012 22:26
Widget Output
<script src='http://fronts.dev/assets/javascripts/widget/bail-calc.js' type='text/javascript'></script> <div id='bail-widget-container' data-attr='[{"maxValue":"1000","percentage":"10"},{"maxValue":"15000","percentage":"15"}]' data-phone='123-456-7890'> Bail Bonds calculator by <a id='ab_link' href='http://www.aboutbail.com/'>AboutBail</a>. </div>
@kirkconnell
kirkconnell / gist:2572352
Created May 1, 2012 23:30
Liquid Template to test fb liquid drops
<ul>
<li>
User Locale: {{ fb.user.locale }}
</li>
<li>
User Country: {{ fb.user.country }}
</li>
<li>
Min Age: {{ fb.user.age.min }}
</li>
@kirkconnell
kirkconnell / binary.rb
Last active December 15, 2015 17:49
Data Structure Skillboost exercises
## SOLUTION
def binary(value, data, low, high)
center = low + (high - low) / 2 # C
if center < low # C
nil # C
elsif data[center] == value # C
center # C
elsif data[center] > value # C
binary(value, data, low, center - 1) # T(n/2) + C
std::list<int> list;
std::list<int>::iterator pos;
pos = list.begin();
list.insert(it, 1024);
pos = std::find(list.begin(), list.end(), 1024);
*pos; // get
# Helps you migrate from attachment_fu
# put it in your /lib dir and include it your xxxx_uploader.rb
module UploaderFu
def partition_dir
("%08d" % model.id).scan(/\d{4}/).join("/")
end
def model_dir
"#{model.class.to_s.underscore}/#{mounted_as}/"