GEdit Extensions Project

Written on 11:54:00 PM by S. Potter

Just a quick post from a long blogging hiatus to let people know that I launched gedit-extensions where I will maintain a set of commonly used GEdit snippets and eventually plugins and tools that others might find useful. You can view the snippet source at the GitHub gedit-extensions repository. I plan on adding documentation to the gedit-extensions wiki in the next couple of days, but for now see the sneak peak in the Ruby example snippets at the end of the post. The name in the comments directly above the example snippet is the shortcut you can use. Type the first few characters of the shortcut and then Ctl+Space key combination to pull up all shortcuts the characters match so far. Choose the relevant shortcut from the drop down list. If the snippet contains variables the first variable will be highlighted for your to fill in, then press TAB to navigate to the next variable to fill in. As you will see most of the shortcuts so far are Ruby, Rails, RSpec or Cucumber specific since there are a few Python snippets I need to untangle from our in-house code references.

# shebang
#!/usr/bin/env ruby
# absrequire
require(File.join(File.dirname(__FILE__), "config", "enviornment")

# habtm
has_and_belongs_to_many :idiots
# unique
:unique => true
# habtmthru
has_and_belongs_to_many :idiots, :through => :village

# belongsto
belongs_to :village

# createtable
create_table :sessions do |t|
  t.column(:name, :string, :limit => 34)
  t.column(:description, :string, :limit => 255)

# addindex
add_index(:sessions, :name)
# changecolumn
change_column(:sessions, :name, :limit => 70)

# removecolumn
remove_column(:sessions, :name)
# irreversible
raise ActiveRecord::IrreversibleMigration, "the reason the migration is irreversible"

# resource
class PersonResource < ActiveResource::Base = ""
  self.element_name = "contacts"
  self.prefix = "v1_0"
  self.user = "supo"
  self.password = "geditrocks"
  self.timeout = 60

# describe
describe PersonResource do
  before(:each) do
    @resource = mock(PersonResource)

  it "should bla" do

  after(:each) do
    @resource = nil

# specmodelerror
it "should have an error on name" do
  @user.should have(1).errors_on(:name)

# specmodelrecords
it "should have 50 records" do
  @states.should have(50).records

# spectemplaterendered
it "should render 'common/user' on get '/user'" do

# specresponsetext
it "should return text 'You were signed out.' in response to post on '/signout'" do
  response.should have_text("You were signed out.")

# specresponseredirect
it "should redirect to action 'index' on post '/users'" do
  response.should redirect_to(:action => 'index')

# specroutefor
it "should map #index to '/users'" do
  route_for(:controller => "users", :action => "index").should == "/users"

# specparamsfrom
it "should generate params for #update" do
  params_from(:put, "/users/1").should == {:controller => "users", :action => "update", :id => "1"}

# spectagexists
response.should have_tag('')

# specnestedtagexists
response.should have_tag('') do
  with_tag('li', 'my menu item')
  # specchildtagexists
  with_tag('li', 'my second menu item')

# specblocktagexists
response[:sidebar].should have_tag('ul#sidebar')

# mockviewhelper

# specsuccess
response.should be_success

# specredirect
response.should be_redirect

# feature
Feature: Search Jobs
  In order to find relevant jobs
  As a Job Seeker
  I need to find jobs relevant to me

  Scenario: Location Search
    Given a search form
    When I enter my zip code
    Then I should see all jobs in and around my zip code
  # scenario
  Scenario: Skills Search
    Given a search form
    When I enter skill keywords
    Then I should see all job descriptions that mention those keywords