git init
or
#!/bin/env python3 | |
# run doing `./archlinux_mirror_list_updater > /etc/pacman.d/mirrorlist` | |
import urllib.request | |
import re | |
import time | |
import sys |
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) |
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 |
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"
Rails flash messages with AJAX requests
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 | |