Skip to content

Instantly share code, notes, and snippets.

# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@bertomartin
bertomartin / rails-3.2-show-exceptions
Created September 11, 2012 19:59 — forked from kedarmhaswade/rails-3.2-show-exceptions
The new way of showing/rendering all exceptions in Rails 3.2+
# put this in an initializer
# a Rails 3.2 addendum for: http://accuser.cc/posts/1-rails-3-0-exception-handling
class MyShowExceptions
def initialize()
@@rescue_responses = Hash.new(:internal_server_error)
@@rescue_responses.update({
'ActionController::RoutingError' => :not_found,
'AbstractController::ActionNotFound' => :not_found,
'ActiveRecord::RecordNotFound' => :not_found,
@bertomartin
bertomartin / Gemfile
Created September 13, 2012 16:13
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
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
@bertomartin
bertomartin / README.md
Created October 17, 2012 17:55 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

Template Components

Used to provide structural templates.

Pattern

t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name
@bertomartin
bertomartin / FacesContext.java
Created October 24, 2012 15:53 — forked from biemond/FacesContext.java
FacesContext and ADF
// FacesContext
FacesContext facesCtx = FacesContext.getCurrentInstance();
// find UIComponent
UIComponent input = facesCtx.getViewRoot().findComponent("f1");
// change the locale
facesCtx.getViewRoot().setLocale( Locale.ENGLISH);
// el expression
@bertomartin
bertomartin / Helper
Created November 15, 2012 19:22 — forked from ciscodesign/Helper
Helper to use Font Awesome with Rails
def icon(name, size=1)
#icon("camera-retro")
#<i class="icon-camera-retro"></i>
html = "<i class='icon-#{name}' "
html += "style='font-size:#{size}em' "
html += "></i>"
html.html_safe
end
@bertomartin
bertomartin / gist:4230344
Created December 7, 2012 02:50 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
=semantic_form_for [:admin, @dog], validate: true, html: {multipart: true} do |f|
=f.inputs do
=f.input :name
=f.input :kennel_name
=f.input :birthdate
=f.input :gender, as: :radio, collection: {'Tik' => 'F', 'Hane' => 'M'}
=f.input :father_id, as: :select, collection: @dogs
=f.input :mother_id, as: :select, collection: @bitches
=f.semantic_fields_for :pictures do |pic|

Adobe Edge Inspect Used while working on mobile/responsive sites to view natively on iPhone, updates in real time. https://chrome.google.com/webstore/detail/adobe-edge-inspect/ijoeapleklopieoejahbpdnhkjjgddem

Benchwarmer This has replaced my pinned Dribbble tab. "New tab" extension, no URL bar icon, transforms your new tab's background into a list of Dribbble popular/everyone/debut/following (you pick) shots. https://chrome.google.com/webstore/detail/benchwarmer-the-dribbble/lhdjhhpjicomphhjpehdhjenbaamdpnn

Bitly Used with custom .htaccess rule and vanity domain to shorten links with 2 clicks.

[Time, Date].map do |klass|
klass::DATE_FORMATS[:variable] = lambda do |t|
date =
case
# display today's date as "today"
when t >= Date.today then "today"
# display yesterday's date as 'Yesterday'
when (t >= Date.yesterday and t <= Date.today) then "yesterday"
# otherwise, display date: eg. Mon 4th June
else