Skip to content

Instantly share code, notes, and snippets.

View zeevallin's full-sized avatar

Zee Vieira zeevallin

View GitHub Profile
source 'http://rubygems.org'
gem 'rake'
group :development do
gem 'pry'
end
upstream cloudsdale {
server 127.0.0.1:3000;
}
upstream cloudsdale_push {
server 127.0.0.1:8000;
}
server {

Getting an avatar

avatar.cloudsdale.org/{users/clouds/apps}/{id/email_hash}.png?s={pixel_size}

Does the url exist in the CDN cache?

  1. Serve the avatar

Does the avatar not exist in the CDN cache?

@zeevallin
zeevallin / doorkeeper.rb
Created May 13, 2013 04:54
Extend doorkeeper models default behaviour using ActiveSupport concerns in rails 3.
Doorkeeper.configure do
orm :mongoid3
resource_owner_authenticator do
if current_user.new_record?
redirect_to(login_path)
else
current_user
end
end
.my-class {
background-color: #030;
.my-nested-class {
background-color: #300;
}
}
class Session
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :identifier, :password, :user
# Public: Initializes the model according to
# regular active model convention.
@zeevallin
zeevallin / production.rb
Last active December 17, 2015 05:08
It should be quite similar using AWS insted of rackspace
# Enable serving of images, stylesheets, and JavaScripts from an asset server
config.action_controller.asset_host = "https://c776950.ssl.cf2.rackcdn.com"
@zeevallin
zeevallin / gist:5554024
Created May 10, 2013 12:09
Responsive email layout with Haml, SASS through Roadie
!!! 5
%html
%head
%link{ rel: "stylesheet", type:"text/css", href: "/assets/email.css" }
%body
%table.email-wrap{ border: "0", cellpadding: "0", cellspacing: "0", align: "right" }
%tr
%td.email-wrap-left{ align: 'left' }
%span= ""
%td.email-wrap-center{ align: 'center' }
desc "Start unicorn"
task :start, :roles => unicorn_role, :except => { :no_release => true } do
env_vars = Hash.new
env_vars[:UNICORN_SOCKET] = "#{sockets_path}/#{unicorn_socket}"
env_vars[:UNICORN_PID] = "#{pids_path}/#{unicorn_pid}"
env_vars[:UNICORN_WORKING_DIR] = "#{current_path}"
env_vars[:UNICORN_STDERR] = "#{logs_path}/#{unicorn_errlog}"
env_vars[:UNICORN_STDOUT] = "#{logs_path}/#{unicorn_acclog}"
servers = find_servers_for_task(current_task)
div {
$height: 100px;
position: absolute;
top: 50%;
width: 200px
height: $height;
margin-top: -($height/2)
}