gem install rails --pre
rails new my_app -T
| module CarrierWave | |
| module VideoConverter | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| def encode_video(target_format) | |
| process :encode_video => [target_format] | |
| end | |
| end | |
| def encode_video(format='mp4') |
| # encoding: utf-8 | |
| class VideoUploader < CarrierWave::Uploader::Base | |
| include CarrierWave::VideoConverter | |
| storage :file | |
| version :mp4 do | |
| process :encode_video => [:mp4] | |
| def full_filename(for_file) |
| dir = Rails.root.join('lib', 'carrierwave_processing') | |
| $LOAD_PATH.unshift(dir) | |
| Dir[File.join(dir, "*.rb")].each {|file| require File.basename(file) } |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>jQuery UI Autocomplete - Custom data and display</title> | |
| <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> | |
| <script src="../../jquery-1.6.2.js"></script> | |
| <script src="../../ui/jquery.ui.core.js"></script> | |
| <script src="../../ui/jquery.ui.widget.js"></script> |
| module Resque | |
| module Mailer | |
| class MessageDecoy | |
| def deliver | |
| record = @args.first | |
| resque.enqueue @mailer_class, @method_name, record.class.name, record.id | |
| end | |
| end | |
| end | |
| end |
| require 'net/ssh' | |
| desc "Deploy site to production" | |
| task :deploy => :environment do | |
| host = 'yourhost.com' | |
| user = 'username' | |
| options = {:keys => '~/.ssh/keys/yourserver.pem'} | |
| remote_path = '/path/to/rails_app' | |
| commands = [ |
| require 'carrierwave/processing/mini_magick' | |
| class ImageUploader < CarrierWave::Uploader::Base | |
| include CarrierWave::MiniMagick | |
| IMAGE_EXTENSIONS = %w(jpg jpeg gif png) | |
| DOCUMENT_EXTENSIONS = %w(exe pdf doc docm xls) | |
| def store_dir | |
| "files/#{model.id}" |
| <!-- A scaffolded edit view converted to mustache --> | |
| <h1>Editing post</h1> | |
| {{#form}} | |
| {{#errors?}} | |
| <div id="error_explanation"> | |
| <h2>{{error_header}}</h2> | |
| </div> | |
| <ul> |
| var Autocomplete = Backbone.View.extend({ | |
| render: function() { | |
| var choices = this.options.choices, | |
| selected = this.options.selected, | |
| iterator = this.options.iterator, | |
| label = this.options.label, | |
| allowDupes = this.options.allowDupes, | |
| $el = $(this.el); | |
| $el.autocomplete({ | |
| source: function(request, response) { |