Skip to content

Instantly share code, notes, and snippets.

#Put this inside ~/.bash_profile
#Function for lazy git commiting.
#Instead of: git commit -m "some message"
#Type: gci some message
gci() {
if [ -z "$1" ] # Is parameter #1 zero length?
then
echo "You must pass a commit message like this: gci some message here - which then becomes: git commit -m 'some message here'"
else
git commit -m "$*"
#!/usr/bin/ruby
require 'rubygems'
require 'blather/client'
setup 'moderator@enterprise-g.local', 'moderator'
message :chat? do |m|
puts m.read_content(:meeting)
end
@gabehollombe
gabehollombe / gist:293193
Created February 3, 2010 00:11
ActiveRecord doesnt like foreign keys?
class Category < ActiveRecord::Base
has_many :assignments, :foreign_key => 'category_uuid', :primary_key => 'uuid'
end
class Post < ActiveRecord::Base
has_many :assignments, :foreign_key => 'post_uuid', :primary_key => 'uuid'
end
class Assignment < ActiveRecord::Base
belongs_to :post, :foreign_key => 'uuid', :primary_key => 'post_uuid'
@gabehollombe
gabehollombe / Capybara CSS Visibility Testing
Created May 14, 2010 05:13
Testing text visibility on page with capybara
#relevant lines in features/support/env.rb
Capybara.default_selector = :css
Capybara.javascript_driver = :culerity
Capybara.ignore_hidden_elements = true
#features/hidden_text_testing.feature
@javascript
Scenario: Testing test hidden via inline style with 'should not see'
When I visit the the public index.html page
Then I should not see "Hidden Via Comment"
@gabehollombe
gabehollombe / Better version
Created May 20, 2010 06:26
Capybara: a better way to check if text is visible
### IMPORTANT NOTE: See the comment thread below for a more concise way to determine this now, using has_css...
#A better 'I should not see' for Capybara that lets jQuery determine visibility of the text you're looking for.
Then /^"([^\"]*)" should not be visible$/ do |text|
finder_script = %{
function is_text_visible_on_page(text) {
var match = false;
$('*:visible')
LabelForNestedStories AnotherLabel
- Feature title (single line description in parens)
- Some other feature (you don't need blank lines seperating your stories but you can use them for extra readability in the file)
- Another feature
Multi-line description of this feature.
Use two tabs to indent for easy visual parsing.
[] Chores look like checkboxes (short description in parens)
grammar PivotalStories
rule stories
story*
end
rule story
feature*
end
rule feature
@gabehollombe
gabehollombe / Example txt to pivotal format
Created September 28, 2010 06:03 — forked from cjheath/Example Treetop grammar fragment
Parsing a text file for Pivotal Tracker stories with Treetop
LabelOne LabelTwo
- feature one (description one)
- feature two (description two)
- feature three with multiline desc following
desc line 1
desc line 2
desc line 3
@gabehollombe
gabehollombe / discover.rb
Created March 25, 2011 00:01
Get autotest to run on spec/integration changes and friends
Autotest.add_hook :initialize do |at|
at.add_mapping(%r%^spec/integration/.*_spec.rb$%, true) { |filename, _|
filename
}
at.add_mapping(%r%^app/(models|controllers|helpers|lib)/.*rb$%, true) {
at.files_matching %r%^spec/integration/.*_spec.rb$%
}
at.add_mapping(%r%^app/views/(.*)$%, true) {
@gabehollombe
gabehollombe / gist:979788
Created May 18, 2011 23:05
Adding a custom 'seconds' function on to Number in JavaScript
> Number.prototype.seconds = function(){ return this * 1000 }
=> function (){ return this * 1000 }
> 1..seconds()
=> 1000
> (1).seconds()
=> 1000
> 1['seconds']()