This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All is good, just a tiny suggestion: | |
# app/controllers/dashboard_controller.rb: line 18 | |
# Instead of: | |
@watched_objects = current_user.user_config.watched_data_objects.split(", ").map{|id| DataObject.find(id)}.flatten.group_by(&:data_type) | |
# Taking of .find syntax accepting list if id's, consider finding them all at once (please test it first) | |
# also .flatten is not needed) | |
DataObject.find(current_user.user_config.watched_data_objects.split(", ")).group_by(&:data_tytpe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
# We are not loading Active Record, nor Active Resources etc. | |
# We can do this in any app by simply replacing the rails gem | |
# by the parts we want to use. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
gem "tzinfo" | |
# Let's use thin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Survey::DSL | |
survey 'Finances Questionnaire' do | |
q "Do you have a Durable Power of Attorney for Finances?" do | |
yes do | |
a "Who is the designated agent for handling your finances?" do | |
field 'Full Name' | |
phone 'Phone Number' | |
email 'Email' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remote repo aliases assumed: | |
# git remote add production production_heroku_app_git_repo | |
# git remote add staging staging_heroku_app_git_repo | |
# add addons if not already | |
# heroku addons:add pgbackups --remote staging | |
# heroku addons:add pgbackups --remote production | |
heroku pgbackups:capture --remote production | |
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmap _hr :%s/\v:(\w+) \=\>/\1:/g<cr> | |
nmap _h :s/\v:(\w+) \=\>/\1:/g<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copied and adapted from https://github.com/matschaffer/zsh-matschaffer/blob/master/tools.zsh | |
# Bundle grep, search for text in bundled gems | |
bgrep() { | |
grep -r "$@" $(bundle show --paths) | |
} | |
# Find files or directories like $1 | |
# Shortcut for: find <dir> -name *<search>* | |
flike() { | |
local search dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Shortcuts for backbone.js via the asset pipeline | |
" using backbone-on-rails gem and generate with backbone namespace | |
autocmd User Rails Rnavcommand bmodel app/assets/javascripts/backbone/models -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand bcollection app/assets/javascripts/backbone/collection -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand brouter app/assets/javascripts/backbone/routers -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand btemplate app/assets/backbone/templates -suffix=.jst.hbs -glob=**/* | |
autocmd User Rails Rnavcommand bview app/assets/javascripts/backbone/views -suffix=.js.coffee -glob=**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file: config/deploy/vagrant.rb | |
# this allows for `cap vagrant deploy` | |
set :rails_env, :production | |
set :server_hostname, "192.168.33.10" | |
server 'vagrant', user: 'vagrant', roles: %w{app web db}, primary: true | |
set :ssh_options, { | |
forward_agent: true, | |
host_name: "127.0.0.1", | |
port: "2222", | |
keys: ['.vagrant/machines/default/virtualbox/private_key'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.0.0-p247 :074 > class Q | |
2.0.0-p247 :075?> def test | |
2.0.0-p247 :076?> puts "no block. but you can pass a block to me" | |
2.0.0-p247 :077?> end | |
2.0.0-p247 :078?> def btest(&block) | |
2.0.0-p247 :079?> puts "with block" | |
2.0.0-p247 :080?> block.call | |
2.0.0-p247 :081?> end | |
2.0.0-p247 :082?> def ctest | |
2.0.0-p247 :083?> if block_given? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://stackoverflow.com/questions/9067559/sorting-ip-addresses-in-vim | |
:%s/\<\d\d\?\>/0&/g|%&&|sor r/\(\d\{3}\)\%(\.\d\{3}\)\{3}/|%s/\<00\?\ze\d//g |
OlderNewer