Skip to content

Instantly share code, notes, and snippets.

@mckeed
mckeed / strong_parameters.rb
Created June 5, 2012 22:24
Before filters to make rails/strong_parameters work with CanCan's load_resource or load_and_authorize_resource.
require 'strong_parameters'
class ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
end
class ActionController::Base
# Use this with CanCan's load_resource to permit a set of params before
# it tries to build or update a resource with them.
@tenderlove
tenderlove / app.ru
Created June 4, 2012 16:39
An adapter for Rack that makes it look like node
##
# Make Rack look like node.
#
# http://youtu.be/Zp91yUH-zAw
#
# Run like this:
#
# $ unicorn -I. app.ru
require 'node_adapter'
@ryanb
ryanb / railscasts_episodes.rb
Created June 4, 2012 06:01
Download source code for all RailsCasts episodes. You may want to cd into an empty directory first.
require "rubygems"
require "octokit" # gem install octokit
1.upto(5) do |page|
Octokit.repositories("railscasts", page: page, per_page: 100).each do |repo|
system "git clone git://github.com/railscasts/#{repo.name}"
end
end

Notable libraries in my Rails + Ember stack

General

  • Devise: Devise uses Rails views, so I have the user management separate from the Ember app.

Templating

  • haml-rails
  • hamlbars
@broccolini
broccolini / frontage.css
Created May 30, 2012 01:15 — forked from nrrrdcore/frontage.css
Outlined Type Effect with CSS Text-Shadowing
body {
background-color: #7A060C;
}
#wrapper {
width: 90%;
margin: 200px auto;
}
h1 {
@nrrrdcore
nrrrdcore / frontage.css
Created May 23, 2012 08:21
Outlined Type Effect with CSS Text-Shadowing
body {
background-color: #FFF;
}
#wrapper {
width: 90%;
margin: 200px auto;
}
h1 {
@nrrrdcore
nrrrdcore / apple-shadow.css
Created May 17, 2012 17:19
Bending Shadows Backwards: Apple.com's Container CSS Sorcery
.shadow-stuff {
-moz-border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
-webkit-border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
-moz-box-shadow: rgba(0,0,0,.30) 0 2px 3px;
-webkit-box-shadow: rgba(0,0,0,.30) 0 2px 3px;
box-shadow: rgba(0,0,0,.30) 0 2px 3px;
}
.container {
@nrrrdcore
nrrrdcore / bending-shadow.css
Last active April 22, 2024 20:54
Simple Bended-Shadow CSS: Create the Bended Photo Effect without writing a million divs.
.bended-shadow {
position: relative;
width: 500px;
margin: 200px auto;
}
.bended-shadow::before, .bended-shadow::after {
content: '';
position: absolute;
width: 60%;
@nrrrdcore
nrrrdcore / border.css
Created May 2, 2012 20:44
Faded/Gradient Borders in Pure CSS
.border-container {
width: 28%; /* border will be on the left on this container */
float: right;
overflow: hidden; /* only needed if floating container */
min-height: 600px; /* static height if you want your container to be taller than its content */
-moz-box-shadow: inset 15px 0 5px -16px rgba(0,0,0,.1), -1px 0 0 #FFF;
-webkit-box-shadow: inset 15px 0 5px -16px rgba(0,0,0,.1), -1px 0 0 #FFF;
box-shadow: inset 15px 0 5px -16px rgba(0,0,0,.1), -1px 0 0 #FFF;
border-width: 0 0 0 1px;
-webkit-border-image:
@nz
nz / configuring tire for bonsai.md
Last active October 1, 2015 18:58
Configuring Tire to work with Bonsai

1. Configure Tire to use the Bonsai ElasticSearch Heroku add-on

gem 'tire'

config/initializers/bonsai.rb

ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']