Skip to content

Instantly share code, notes, and snippets.

View joshchernoff's full-sized avatar
💀
For your ego

Josh Чернов joshchernoff

💀
For your ego
View GitHub Profile
@dch
dch / websockets-with-gun.ex
Created September 15, 2015 21:52 — forked from ashneyderman/gist:5eca8b1bed16a7b6f4be
Use of gun from elixir
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)

Git Cheat Sheet

Commands

Getting Started

git init

or

@yctay
yctay / figaro-capistrano.rb
Created April 30, 2013 05:34
Capistrano recipe for deploying figaro's application.yml
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
@linjunpop
linjunpop / Change-Default-Date-Format-In-Rails.md
Last active December 10, 2015 19:19
Change default date format in Rails

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"
@linjunpop
linjunpop / README.md
Created August 21, 2012 01:15
Rails flash messages with AJAX requests
@jjhageman
jjhageman / item_image.rb
Created June 3, 2011 20:59
Extracting Geolocation Image Data with Carrierwave and RMagick on Heroku
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