Rails flash messages with AJAX requests
This file contains 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
class ItemImage < ActiveRecord::Base | |
belongs_to :item | |
mount_uploader :image, ImageUploader | |
before_save :extract_geolocation | |
def extract_geolocation | |
img = Magick::Image.read(image)[0] rescue nil | |
http://www.ruby-forum.com/topic/57923#47371
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
:default => '%m/%d/%Y'
)
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
:default => '%m/%d/%Y %I:%M %p',
:date_time12 => "%m/%d/%Y %I:%M %p",
:date_time24 => "%m/%d/%Y %H:%M"
This file contains 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 :figaro do | |
desc "SCP transfer figaro configuration to the shared folder" | |
task :setup do | |
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp | |
end | |
desc "Symlink application.yml to the release path" | |
task :finalize do | |
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml" | |
end |
This file contains 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
defmodule Transport do | |
def connect(params) do | |
hostname = params.hostname | |
port = params.port | |
path = params.path | |
timeout = params.connection_timeout | |
{:ok, conn} = :gun.open(hostname, port) | |
{:ok, :http} = :gun.await_up(conn) | |
:gun.ws_upgrade(conn, path) |