Skip to content

Instantly share code, notes, and snippets.

View mvoto's full-sized avatar

Mauricio Voto mvoto

  • Port Coquitlam, BC
View GitHub Profile
RAILS_ENV=production rake db:setup
# produces the error below.....hmmm.....it's a no-worky
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
# hstore postgresql extension needs to be installed, so....
sudo apt-get install postgresql-contrib
# now your extension should be available to enable so log in with psql
psql -d yourproject_production -U yourdbuser -W
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@mvoto
mvoto / gist:8460852
Created January 16, 2014 18:43 — forked from ryansobol/gist:5252653
15 Ruby questions

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@mvoto
mvoto / gist:5828055
Last active December 18, 2015 18:49 — forked from Belgand/gist:2856947
Sublime shortcuts

Sublime Text 2 – Useful Shortcuts (Ubuntu)

Editing

Ctrl+X cut current line (if no selection)
Ctrl+L select line (repeat select next lines)
Ctrl+D select word (repeat select others occurrences in context for multiple editing)
Ctrl+Shift+M select content into brackets
Ctrl+Backspace delete previous word
Ctrl+Delete delete next word
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\]"
@mvoto
mvoto / gist:2161722
Created March 22, 2012 18:50 — forked from klebervirgilio/gist:2161451
Array#by
class Array
def by(n)
buff, self_ = [], self.clone
if self.size % n == 0
(self.size/n).times{ buff << self_.shift(n) }
end
buff
end
@mvoto
mvoto / will_paginate.rb
Created March 2, 2012 15:20 — forked from isaacbowen/will_paginate.rb
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@mvoto
mvoto / install_postgis_osx.sh
Created February 22, 2012 13:41 — forked from lucasallan/install_postgis_osx.sh
Installing PostGIS on Mac OS X and Ubuntu
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@mvoto
mvoto / gist:1596594
Created January 11, 2012 20:27 — forked from lucasallan/gist:1596363
Books
Current:
* Clean Code
* Crafting Rails Applications
Next:
* Domain-driven Design
* Design Patterns in Ruby