<%= f.input :state, :collection => ['SA', 'WA'] %>
<%= f.input :state,
:as => :radio_buttons,
class Notifier < ActionMailer::Base | |
delivers_from 'notifications@example.com' | |
def welcome(user) | |
@user = user # available to the view | |
mail(:subject => 'Welcome!', :to => user.email_address) | |
# auto renders both welcome.text.erb and welcome.html.erb | |
end | |
def goodbye(user) |
These are some snips to help you converting video to flash and thumbnails using ruby and paperclip. | |
Needed: ffmpeg & flvtool, RVideo gem, paperclip | |
Converting the video is done using outside of paperclip, as this could take quite a while. Paperclip by default does it's conversions during the request, and the last thing you want is a request hanging for 10minutes while ffmpeg does it's thing. It is advised to do this conversion somewhere in the background using Resque or DelayedJob. (make sure not to run to many conversions at one time on your machine) | |
Most video thumbnailing solutions out there will create all thumbnails from the video. This solution (on paperclip 2.3.0) however will create one large "temp_thumbnail" once and all consequent thumbnails can use this temporary version. | |
VideoGeometry will make sure that the target dimensions for ffmpeg are always a multiple of 2 and as close as possible to the desired dimensions without breaking the aspect ratio of the original video. |
class AddAttachmentsDataToWrapper < ActiveRecord::Migration | |
def self.up | |
add_column :wrappers, :data_file_name, :string | |
add_column :wrappers, :data_content_type, :string | |
add_column :wrappers, :data_file_size, :integer | |
add_column :wrappers, :data_updated_at, :datetime | |
end | |
def self.down | |
remove_column :wrappers, :data_file_name |
var express = require('express'); | |
var redis = require('redis'); | |
const serverType = process.argv[2]; | |
const serverHost = process.argv[3]; | |
const serverPort = parseInt(process.argv[4]); | |
const redisPort = 6379; | |
const redisHost = '127.0.0.1'; |
module VideoInformation | |
def get_video_file_information(file_path) | |
command = "-i #{file_path} 2>&1" | |
begin | |
video_info = Paperclip.run('ffmpeg', command, :expected_outcodes => [0, 1, 2, 3]) | |
parse_video_info(video_info) | |
rescue Cocaine::ExitStatusError => e | |
Rails.logger.error("There was an error getting the video information from file #{file_path}") | |
Rails.logger.error(e) | |
end |
# Forked to get it working with Rails 3 and RSpec 2 | |
# | |
# From http://github.com/jaymcgavren | |
# | |
# Save this as rcov.rake in lib/tasks and use rcov:all => | |
# to get accurate spec/feature coverage data | |
# | |
# Use rcov:rspec or rcov:cucumber | |
# to get non-aggregated coverage reports for rspec or cucumber separately |
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary ' | |
{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } } | |
{ "name" : "auchan", "owner" : "chris" } | |
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } } | |
{ "name" : "toys", "numberOfProducts" : 150 } | |
{ "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } } | |
{ "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" } | |
' |
Follow the steps below to install Team City 9.0.3 on Ubuntu with Nginx as the proxy for port 80.
Install Team City:
# will install on port 8111
sudo wget -c https://gist.githubusercontent.com/sandcastle/9282638/raw/teamcity-install.sh -O /tmp/teamcity-install.sh
teamcity
user: adduser -s /bin/bash teamcity
usermod -a -G admin,teamcity teamcity
sudo apt-get update
sudo apt-get install -y openjdk-8-jre-headless
sudo apt-get install -y curl
sudo apt-get install -y postgresql-client postgresql postgresql-contrib
sudo -u postgres psql postgres