Skip to content

Instantly share code, notes, and snippets.

gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
class String
def camel_case
parts = self.split
parts.each { |p| p.capitalize! }
parts[0].downcase!
parts.join
end
def camel_case!
parts = self.split
@beaugaines
beaugaines / gist:7226384
Last active December 26, 2015 22:49
Sublime keymap for Linux
[
{ "keys": ["ctrl+shift+."], "command": "erb" },
{ "keys": ["ctrl+shift+t"], "command": "delete_trailing_spaces" },
# jump to beginning of line
{ "keys": ["alt+9"], "command": "move_to", "args": {"to": "bol", "extend": false}},
# jump to end of line
{ "keys": ["alt+0"], "command": "move_to", "args": {"to": "eol", "extend": false}},
{ "keys": ["alt+u"], "command": "insert", "args": {"characters": "_"} },
{ "keys": ["alt+="], "command": "insert", "args": {"characters": "=>"} },
class Shape
attr_accessor :color
def initialize(color="red")
@color = color
end
end
class Circle < Shape

This re-styles your sublime text 2 sidebar to be darker, so it doesn't blind you when using a dark theme.

Dark sublime text 2 sidebar

Save the Default.sublime-theme file into packages/Theme - Default, make a backup of your original if you want to be able to go back easily.

%h4= @wikiview.wiki_title
%p= @wikiview.wiki_content
%h5 Add collabos
= form_for(@wikiview.wiki) do
%table
%tr
%th Email
%th Add collabo
# git
alias gmv='git remote -v'
alias m='git add .;git commit -m' # ex: "m New Feature"
alias ga='git add .'
alias gl='git pull'
alias gp='git push'
alias gd='git diff'
alias gdd='git diff HEAD HEAD^1'
alias gco='git checkout'
alias gb='git branch'
def add_item (item, list)
# nb: no need to return list explicitly; the << operator - which
# is a method in the Array class - returns the Array itself.
list << item unless list.include?(item)
# list
# also, no need for this else statement
# else
#list
#end
@beaugaines
beaugaines / edit.html.erb
Created April 10, 2014 03:22
User edit form
<!-- app/views/devise/registrations/edit.html.erb -->
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<div class="row">
<div class="col-md-8">
<h3>Change email or password</h3>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :patch }) do |f| %>
<%= devise_error_messages! %>
<div class="form-group">
class AddHstoreExtension < ActiveRecord::Migration
def up
execute 'CREATE EXTENSION hstore'
end
def down
execute 'DROP EXTENSION hstore'
end
end