Skip to content

Instantly share code, notes, and snippets.

View brennovich's full-sized avatar
👋
Hey, there

Brenno Costa brennovich

👋
Hey, there
View GitHub Profile
@brennovich
brennovich / application.html.haml
Created December 27, 2011 17:04 — forked from dagda1/application.html.haml
application.html.haml
!!!
%head
%meta{:charset => "utf-8"}
%meta{:author => "Brenno Costa"}
%title Application Layout Hamlfy
=stylesheet_link_tag "application"
=javascript_include_tag "application"
=csrf_meta_tags
%body
@brennovich
brennovich / Gemfile
Created December 27, 2011 17:38 — forked from chriseppstein/readme.md
How to integrate Compass with Rails 3.1 asset pipeline
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass', '~> 0.12.alpha'
# include other compass plugins here. E.g.:
gem 'compass-susy-plugin', :require => 'susy'
end
@brennovich
brennovich / bundles.sh
Created January 5, 2012 00:10 — forked from mkdynamic/bundles.sh
Install all of http://github.com/phuibonhoa's TM bundles (OS X only)
#!/usr/bin/env bash
#
# install all of http://github.com/phuibonhoa's TM bundles (OS X only)
#
echo "Installing bundles..."
# backup dir
if [ -d ~/desktop/_tm_bundle_backups ]; then rm -rf ~/desktop/_tm_bundle_backups; fi
@brennovich
brennovich / nginx
Created January 6, 2012 23:55 — forked from nofxx/nginx
nginx rc.d script archlinux
#!/bin/bash
# NGINX RC.D SCRIPT
# Archlinux
NGINX_CONFIG="/opt/nginx/conf/nginx.conf"
NGINX_BIN="/opt/nginx/sbin/"
#. /etc/conf.d/nginx
. /etc/rc.conf
. /etc/rc.d/functions
@brennovich
brennovich / devise.pt-BR.yml
Created January 8, 2012 22:43 — forked from mateusg/devise.pt-BR.yml
pt-BR translations for Devise
# encoding: UTF-8
# pt-BR translations for Devise
pt-BR:
errors:
messages:
not_found: "não encontrado"
already_confirmed: "já foi confirmado"
not_locked: "não foi bloqueado"
not_saved:
one: "Não foi possível salvar %{resource}: 1 erro"
@brennovich
brennovich / etc_init.d_unicorn_example.co.uk
Created February 5, 2012 14:06 — forked from scottlowe/etc_init.d_unicorn_example.co.uk
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@brennovich
brennovich / attr_acessible_security.rb
Created March 5, 2012 14:15 — forked from rafaelp/attr_acessible_security.rb
How to protect against mass assignment attack
# Put this file on config/initializer
# This will create an empty whitelist of attributes available for mass assignment for
# all models in your app. As such, your models will need to explicitly whitelist
# accessible parameters by using an attr_accessible declaration. This technique is best
# applied at the start of a new project. However, for an existing project with a thorough
# set of functional tests, it should be straightforward and relatively quick to insert this
# initializer, run your tests, and expose each attribute (via attr_accessible) as dictated
# by your failing tests.
@brennovich
brennovich / config.ru
Created March 5, 2012 21:35
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@brennovich
brennovich / capybara cheat sheet
Created September 15, 2012 20:49 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=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')