This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paperclip gem | |
# How to fix the issue with ImageMagick crashing on non-image files. | |
# Must be placed before has_attached_file | |
# Source: http://awesomeful.net/posts/33-attach-non-image-files-in-rails-with-paperclip | |
before_post_process :image? | |
def image? | |
!({your_model}_content_type =~ /^image.*/).nil? | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/spree_config.rb | |
# Check if Spree::Config is loaded | |
# If you don't you'll get an error on migrate (the first time only) | |
if Spree::Config.instance | |
Spree::Config.set(:default_locale => "nl-NL") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s -d'postdata=something' -D- http://url -o/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/assets/javascripts/failer.js.coffee | |
class Failer | |
ze: (i) -> | |
i + "wa" | |
window.failer = new Failer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/javascripts/templates/hello.jst.eco | |
<h1>Hello <%= @name %>!</h1> | |
# Eco uses instance variables for variables given by the test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From: https://github.com/ryanb/cancan/pull/757 | |
# Here for reference | |
## | |
# Tell CanCan to use the user-controller resource_params method | |
# rather than its own (when the user-method) is available | |
module CanCan | |
class ControllerResource | |
def resource_params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
As of version 1.1.2, Propane will load and execute the contents of | |
~Library/Application Support/Propane/unsupported/caveatPatchor.js | |
immediately following the execution of its own enhancer.js file. | |
You can use this mechanism to add your own customizations to Campfire | |
in Propane. | |
Below you'll find two customization examples. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#counter").counter({ | |
autoStart: false, // true/false, default: true | |
duration: 5000, // milliseconds, default: 1500 | |
countFrom: 10, // start counting at this number, default: 0 | |
countTo: 30, // count to this number, default: 0 | |
runOnce: true, // only run the counter once, default: false | |
placeholder: "?", // replace the number with this before counting, | |
// most useful with autoStart: false. default: undefined | |
easing: "easeOutCubic", // see http://gsgd.co.uk/sandbox/jquery/easing | |
// for all available effects, see visual examples: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "prawn" | |
pdf = Prawn::Document.new do |prawn| | |
prawn.font_families.update("OpenSans" => { | |
normal: "book/assets/fonts/OpenSans-Regular.ttf", | |
italic: "book/assets/fonts/OpenSans-Italic.ttf", | |
bold: "book/assets/fonts/OpenSans-Bold.ttf", | |
bold_italic: "book/assets/fonts/OpenSans-BoldItalic.ttf" | |
}) | |
["Helvetica", "Courier", "OpenSans"].each do |f| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :appsignal do | |
# Description is required for it to show up in the tasks list. | |
desc 'Notify AppSignal of this deploy!' | |
task :deploy do | |
# 1. Needs to be run inside an `on` block | |
# 2. `appsignal_roles` setting set and supplied with default | |
on roles(fetch(:appsignal_roles, :app)) do | |
env = fetch(:rails_env, 'production') | |
user = ENV['USER'] || ENV['USERNAME'] |
OlderNewer