Skip to content

Instantly share code, notes, and snippets.

@justinfrench
justinfrench / .gitconfig
Created January 6, 2012 10:36
Git aliases for tracking and publishing git branches (usage: `git publish`)
[alias]
current-branch = !git branch | grep '^*' | sed s/\\*\\ //
track = !git branch --set-upstream $(git current-branch) origin/$(git current-branch)
publish = !git push origin $(git current-branch) && echo $(git track)
@justinfrench
justinfrench / formtastic_extentions.rb
Created June 16, 2011 23:40 — forked from rhulse/formtastic_extentions.rb
Formtastic 2.0 custom input upgrade examples
# This file contains custom input method from formtastic 1.2 and their
# replacement classes in 2.0
module FormtasticExtensions
class WysiwygInput < Formtastic::Inputs::TextInput
def input_html_options
wysiwyg_type = input_options.delete(:controls)
@justinfrench
justinfrench / gist:999731
Created May 31, 2011 01:27
Did you know there's a less painful way to do data attributes in Rails?
# This has very little win:
<%= content_tag(:p, "Foo", "data-bah" => "...", "data-baz" => "...") %>
# Some chumps make it even more noisy:
<%= content_tag(:p, "Foo", :"data-bah" => "...", :"data-baz" => "...") %>
# I was going to patch Rails to convert :data_bah to "data-bah"
<%= content_tag(:p, "Foo", :data_bah => "...", :data_baz => "...") %>
# But they already do this:
@justinfrench
justinfrench / gist:999715
Created May 31, 2011 01:12
Did you know you can pass classes into Rails tag helpers as Arrays?
# Let's say you've programatically built up an array of classes for a HTML element:
my_classes = [:a, :b, 'c']
# Don't do this, join(" ") is for chumps:
<% content_tag(:p, "Foo", :class => my_classes.join(" ")) %>
# Winners do this:
<% content_tag(:p, "Foo", :class => my_classes) %>
# => <p class="a b c">Foo</p>
<% link_to("Foo", foos_path, :class => my_classes) %>
/*
This is a pretty crappy brief to tout the benefits of "good CSS", "good SASS",
"good OOCSS" or anything else, but let's roll with it for now.
*/
#Nav {height:45px;background:transparent}
#Nav ul {list-style:none;margin:10px 0 0 7px}
#Nav ul li {display:inline}
#Nav ul li a {list-style-type:none;display:inline-block;padding:10px 20px;color:#a1a1a1;background:#f4f4f4;border:1px solid #d1d1d1;text-transform:uppercase;-moz-border-radius:4px;-webkit-border-radius:4px;-moz-box-shadow:0 1px 3px #f1f1f1;-webkit-box-shadow:0 1px 3px #f1f1f1}
/* Main navigation elements.
-------------------------------------------------------------- */
#Nav {height:45px;background:transparent}
#Nav ul {list-style:none;margin:10px 0 0 7px}
#Nav ul li {display:inline}
#Nav ul li a {list-style-type:none;display:inline-block;padding:10px 20px;color:#a1a1a1;background:#f4f4f4;border:1px solid #d1d1d1;text-transform:uppercase;-moz-border-radius:4px;-webkit-border-radius:4px;-moz-box-shadow:0 1px 3px #f1f1f1;-webkit-box-shadow:0 1px 3px #f1f1f1}
= semantic_form_for @user_profile, :url => user_user_profile_path(@user), :html => {:multipart => true} do |form|
%p.large Personal information
%hr.profile
%p.smlTitle Phone Number
= form.inputs do
= form.semantic_fields_for :profile_phones do |phone|
= render 'profile_phone_fields', :form => phone
= link_to_add_fields "Add Phone", form, :profile_phones, "addPhone"
= form.buttons
= semantic_form_for @pet do |form|
= form.inputs do
= form.input :animal
= form.input :diseases, :as => :check_boxes, :value_as_class => true
= form.buttons
foldingStartMarker = '(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl|article|section|header|footer)\b.*?>
|<!--(?!.*-->)
|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
|<%.*?do\s?(\|[a-z0-9_,\s]\|)?\s?-?%>
)';
foldingStopMarker = '(?x)
(</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl|article|section|header|footer)>
|^\s*-->
|(^|\s)\}
"You will receive a confimation email with in the business day.In case you haven't received Please call 13 6954 (13 myki) with your myki reference number ."
* spelling error "confimation"
* missing space "day.In"
* missing words and not need for capitalisation "haven't received Please call"
* missing the reference number "with your myki reference number ."
That was after filling in the feedback form 3 times and spending 30 mins on the phone with a nice person who couldn't actually help me.