Skip to content

Instantly share code, notes, and snippets.

==> Downloading https://go.googlecode.com/files/go1.1.2.src.tar.gz
Already downloaded: /Library/Caches/Homebrew/go-1.1.2.tar.gz
tar xf /Library/Caches/Homebrew/go-1.1.2.tar.gz
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file src/cmd/ld/lib.c
Hunk #1 succeeded at 665 with fuzz 2.
==> ./make.bash --no-clean
# Building C bootstrap tool.
cmd/dist
# With thanks to https://github.com/optoro/activerecord-callback_notification for original inspiration
if Rails.env.development?
module ActiveRecord
module CallbackNotifications
extend ActiveSupport::Concern
module ClassMethods
def notify_all_callbacks
# Make sure all models are loaded before trying to enumerate
### INSTALLATION NOTES ###
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
# Character Encoding: Unicode (UTF-8)
# Report Terminal Type: xterm-256color
# 7. Put itunesartist and itunestrack into PATH
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'parallel_assets_compiler'
s.version = '0.2.0'
s.platform = Gem::Platform::RUBY
s.author = 'Jørgen Orehøj Erichsen'
s.email = 'joe@erichsen.net'
s.summary = 'Compile assets in parallel'
s.description = 'Compile assets in parallel to speed up deployment'
- if taxonomy_products.products.present?
p class="l-title--large"
strong
=' taxonomy_products.title
= taxonomy_products.taxonomy_title
ul
- taxonomy_products.products.each_with_index do |product, index|
- present(product, Front::Catalog::ProductPresenter) do |presenter|
li class="m-vignette-product m-large-vignette-list #{'last' if (index + 1) % 3 == 0}"
= link_to(presenter.image_tag(:large), taxonomy_products.path_for_catalog_product(product))
@tgautier
tgautier / README.md
Created February 24, 2013 23:27 — forked from lucasmazza/README.md

Devise / Warden Tagged logging

I wrote a middleware (actually two, but they do the same with different implementations) that logs information about signed in scopes in a Rails + Devise application. The solution works with multiple logins (like having a person logged both as an Admin and a User). I tested against Rails 4 and Devise HEAD, but it should work fine in any Rails 3 application.

This solution doesn't use the log_tags configuration option since it isn't very helpful when you need to retrieve information stored in cookies/session. That information isn't 'ready' when the Rails::Rack::Logger is executed, since it happens way down in the middleware chain.

Add one of the following implementations to your application load path and use the following configuration to add the middleware to your application stack:

# application.rb
@tgautier
tgautier / gist:4659103
Created January 28, 2013 21:17
From jQuery to Backbone

Step by step from jQuery to Backbone

I've seen many struggle when they first meet Backbone.js. In this blog post I will gradually refactor a bit of code from how I used to write JavaScript before, into proper Backbone.js code using models, collections, views and events. Hopefully this process will give you a firm understanding of the core abstractions in Backbone.js.

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

git config --global alias.ksreview '!f() { local SHA=${1:-HEAD}; local BRANCH=${2:-master}; if [ $SHA == $BRANCH ]; then SHA=HEAD; fi; git difftool -y -t Kaleidoscope $BRANCH...$SHA; }; f'
require 'singleton'
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code
# invoked during a single request.
#
# Example:
#
# 1) Make sure this file is loaded in an initializer
#
# 2) Add the following to your application.rb in Rails3: