Skip to content

Instantly share code, notes, and snippets.

View iqbalhasnan's full-sized avatar
:shipit:
shipit

Iqbal Hasnan iqbalhasnan

:shipit:
shipit
  • Kuala Lumpur, Malaysia
  • 12:51 (UTC +08:00)
View GitHub Profile
class ArticleImageUploader < ImageUploader
process :fix_exif_rotation
process :strip
process :convert => 'jpg'
process :quality => 85 # Percentage from 0 - 100
version :gallery_thumb do
process :resize_to_fill => Settings.images.article_images.processing.gallery_thumb #44x44
end

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh [email protected]

Add ssh fingerprint and enter password provided in email

module RedisHelper
# decode Redis value back to Ruby object
def self.decode(json)
self.new(ActiveSupport::JSON.decode(json)["#{self.name.downcase}"])
end
# encode Ruby object for Redis
def encoded
self.updated_at = nil
self.to_json
@iqbalhasnan
iqbalhasnan / Gemfile
Last active August 29, 2015 14:07 — forked from Joseph-N/Gemfile
source 'https://rubygems.org'
# default gems here
#---------------------------
# add paperclip and bootstrap
gem "paperclip", "~> 4.1"
gem 'bootstrap-sass', '~> 3.1.1'
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@iqbalhasnan
iqbalhasnan / spree_backend_install.md
Created November 14, 2015 11:34 — forked from huoxito/spree_backend_install.md
Spree backend install

Set up a Spree backend only install

rails new store-backend

Gemfile

gem 'spree_backend', github: 'spree/spree'
@iqbalhasnan
iqbalhasnan / capybara cheat sheet
Created April 28, 2016 03:43 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')