Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / .sassdoc
Last active December 17, 2015 10:40
Sassdoc Vulcan Theme Exception
groups:
page-colors: "Page Colors"
page-typography: "Page Typography"
@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 / 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";
@tf
tf / headers
Created July 20, 2016 10:25
doclets.io Github Hook
Request URL: https://ci.doclets.io/github/callback
Request method: POST
content-type: application/json
Expect:
User-Agent: GitHub-Hookshot/8d6c563
X-GitHub-Delivery: 5b304e00-4e63-11e6-8cf3-7a3df8ed0a05
X-GitHub-Event: push
X-Hub-Signature: sha1=54f0ff5fe40d7ba57f1b13f37f6649e53c8a8077
@tf
tf / without_password_protection_scopes.rb
Created September 21, 2016 10:30
Pageflow `without_password_protection` scopes
module WithoutPasswordProtectionScopes
module Revision
extend ActiveSupport::Concern
included do
scope(:without_password_protection,
-> { where('password_protected IS NOT TRUE') })
end
end
@tf
tf / scss-themes.md
Last active September 21, 2016 15:02

Configurable Themes with SCSS

@tf
tf / stacktrace
Last active December 6, 2016 13:53
install-node-and-yarn with invalid version number
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-yarn (install node a
nd yarn) on project WDRVerkehrWebsite: Execution install node and yarn of goal com.github.eirslett:frontend-maven-
plugin:1.3:install-node-and-yarn failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-
plugin:1.3:install-node-and-yarn (install node and yarn) on project WDRVerkehrWebsite: Execution install node and
yarn of goal com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-yarn failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleB