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
  • 14:23 (UTC +08:00)
View GitHub Profile
@iqbalhasnan
iqbalhasnan / devise.my.yml
Last active June 19, 2020 02:57
Devise Malaysian Translation
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
my:
errors:
messages:
not_found: "Tidak dijumpai"
already_confirmed: "Sudah disahkan"
not_locked: "Tidak dikunci"
devise:
@iqbalhasnan
iqbalhasnan / gist:7754893
Last active December 30, 2015 01:18
install postgreSQL 9 on Mavericks OSX 10.9 using home-brew
Update Brew:
brew update
Install postgreSQL:
brew install postgresql
Init database:
@iqbalhasnan
iqbalhasnan / gist:8584506
Created January 23, 2014 18:51
generate random password with diceware wordlist
#!/bin/bash
#
# Author: Iqbal Hasnan and Tony Xu at The Ohio State University
# Description: This script generates a secure, easy-to-remembers random passphrase
# based on diceware wordlist and random number from random.org
#
# run: ./passwordgenerator.sh
# check if the diceware wordlist exists in local machine
if [ ! -f diceware.txt ]; then
@iqbalhasnan
iqbalhasnan / index.html
Last active July 7, 2016 00:53
Bootstrap 3 + Salvattore - A jQuery Masonry/Isotope alternative with CSS-driven configuration. See it live here : http://codepen.io/tobsn/pen/EPdejY
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootstrap 3 + Salvattore Example, A 'jQuery Masonry' alternative with CSS-driven configuration.</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="salvattore.css">
</head>
<body>
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
@iqbalhasnan
iqbalhasnan / carrierwave.rb
Last active May 25, 2023 06:06
carrierwave mini_magick image processing - quality, strip, exif rotation, gaussian blur, interlace
#config/initializers/carrierwave.rb
module CarrierWave
module MiniMagick
# Rotates the image based on the EXIF Orientation
def exif_rotation
manipulate! do |img|
img.auto_orient
img = yield(img) if block_given?
img
end
@iqbalhasnan
iqbalhasnan / User.rb
Created July 6, 2014 05:14
Rails 4.1.4 + Devise (3.2.4) + delayed_job mailer simple solution
# app/models/User.rb
#As we all know that Devise sends all emails through the send_devise_notification method
#So, without having to install devise-async gem , we just need to change the code to send it asynchronously
# send to the delayed_job queue
def send_devise_notification(notification, *args)
devise_mailer.delay.send(notification, self, *args)
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 root@123.123.123.123

Add ssh fingerprint and enter password provided in email