Skip to content

Instantly share code, notes, and snippets.

@tf
tf / nginx.conf
Last active December 30, 2015 12:39
Paperclip IOAdapter for nginx_upload Module Integration
location ~ ^/entries/[0-9]+/files$ {
upload_pass @app;
upload_store /mnt/nginx_uploads 1;
upload_store_access user:rw group:rw all:r;
upload_set_form_field $upload_field_name[original_name] "$upload_file_name";
upload_set_form_field $upload_field_name[content_type] "$upload_content_type";
upload_set_form_field $upload_field_name[tmp_path] "$upload_tmp_path";
@mixin background-icon($color: #444, $font-size: 19px, $left: 5px, $top: 5px) {
position: relative;
&:before {
position: absolute;
left: $left;
top: $top;
font-size: $font-size;
line-height: 1;
@tf
tf / .sassdoc
Last active December 17, 2015 10:40
Sassdoc Vulcan Theme Exception
groups:
page-colors: "Page Colors"
page-typography: "Page Typography"
@tf
tf / invitation.html.erb
Created November 12, 2015 09:08
InvitedUser for Devise > 3.0
<p><%= t('.salutation', first_name: @user.first_name, last_name: @user.last_name) %>,</p>
<p><%= t('.instruction') %></p>
<p><%= link_to main_app.edit_user_password_url(@user, :reset_password_token => @token),
main_app.edit_user_password_url(@user, :reset_password_token => @token) %></p>
<p><%= t('.ending') %></p>
<p><%= t('.greeting') %></p>
@tf
tf / rspec_test.rb
Created September 11, 2012 06:10
Using RSpec expectations in MiniTest tests
module RSpecTest
include RSpec::Matchers
def self.included(base)
base.extend ClassMethods
end
def expect(*a, &b)
# So number of assertions equals number of expectations in output
assert(true)
@tf
tf / resque_enqueue_after_transaction_patch.rb
Created February 6, 2015 09:27
Resque enqueue after transaction
# Make sure no jobs are enqueued from a rolled back
# transaction.
#
# Note the after_transaction yields immediately if there is no open
# transcation.
require 'ar_after_transaction'
require 'resque'
Resque.class_eval do