pbcopy < file.txt
command | pbcopy
package com.company.sample.widgets; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** | |
* FittedImageView | |
* @extends ImageView | |
* |
sudo $(rbenv which passenger-install-nginx-module) |
# app/controllers/concerns/json_default.rb | |
# USAGE: | |
# Simply include into a controller that should be restricted to JSON format: | |
# `include JSONDefault` | |
module JSONDefault | |
extend ActiveSupport::Concern | |
included do | |
before_action :set_default_format, :assert_valid_format! |
pp (YourClass.methods - Object.methods).sort |
The file attached to this Gist in XCF format is a template ready for professional printing with correct bleed and safety margins applied for editing in GIMP. Feel free to download and use it for your own projects. I've created this file because while I found a bunch of instructions on how to set up the file, I couldn't find a good starter. Here it is! I've followed the instructions on The Online Printer's guide to preparing GIMP files, but I also welcome any additional tips.
# Save this in config/initializers/csv_renderer.rb | |
ActionController::Renderers.add :csv do |obj, options| | |
filename = options[:filename] || 'data.csv' | |
str = obj.respond_to?(:to_csv) ? obj.to_csv : obj.to_s | |
send_data str, | |
type: Mime::CSV, | |
disposition: "attachment", | |
filename: filename | |
end |
# config/initializers/inflections.rb | |
ActiveSupport::Inflector.inflections(:en) do |inflect| | |
inflect.acronym 'API' | |
end | |
# app/controllers/api/widgets_controller.rb | |
module API | |
class WidgetsController < BaseController | |
end | |
end |
def set_access_token | |
begin | |
self.access_token = Devise.friendly_token[0..12] | |
end while ClientForm.exists?(access_token: self.access_token) | |
end | |
# Turn off authority logging while running tests | |
Authority.configure do |config| | |
config.logger = Logger.new('/dev/null') | |
end | |