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
  • 08:55 (UTC +08:00)
View GitHub Profile
@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
This gist is the update of this post https://u.osu.edu/hasnan.1/2014/03/30/rails-4-multiple-file-upload-with-carrierwave-nested-form-and-jquery-file-upload/
License MIT
@iqbalhasnan
iqbalhasnan / option_groups_from_collection_for_select.rb
Created January 7, 2017 00:38
ActiveAdmin Group Select With Formstatic
class Category < ApplicationRecord
has_many :types
end
class Type < ApplicationRecord
belongs_to :category
end
# Admin DSL. you need to pass the the selected type_id by passing the form object value.
f.input :category
@iqbalhasnan
iqbalhasnan / Dockerfile
Last active November 12, 2021 15:12
Rails 6 Docker Image - Ruby 3, Postgres, Webpack https://hub.docker.com/r/iqbalhasnan/rails-6-dev
FROM ruby:3.0.2-alpine
ENV ROOT=/var/www/app \
BUNDLE_PATH=/var/www/app/vendor/bundle
ENV BUNDLE_BIN=$BUNDLE_PATH/bin
ENV PATH $ROOT/bin:$BUNDLE_BIN:$PATH
RUN apk update && apk upgrade && apk add --update --no-cache \
build-base \
curl-dev \
@iqbalhasnan
iqbalhasnan / tmux-cheatsheet.markdown
Created June 15, 2016 04:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@iqbalhasnan
iqbalhasnan / gist:ed92fa2450cab9c5b63d2402f3ff2c72
Created February 25, 2020 00:46
Spark Hive errors and solutions
1.
Error:
java.io.IOException: java.lang.IllegalArgumentException: bucketId out of range: -1
Solution:
set hive.fetch.task.conversion=none;
2.
Error:
java.io.IOException: [Error 30022]: Must use HiveInputFormat to read ACID tables
@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:dcd034a2ef300df65fe71baf3adafd4f
Created March 23, 2017 03:45
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
ERROR
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
FIX
brew update && brew install gmp && rvm reinstall 2.2.5
@iqbalhasnan
iqbalhasnan / gist:5e859772e6014bc6e17630fe207001ba
Created February 2, 2017 14:48
Capistrano 3 - Changed Repository URL Fix
1 ) remove /home/deployer/appName/repo
2 ) cap production deploy
@iqbalhasnan
iqbalhasnan / carrierwave.rb
Created January 10, 2017 16:00
Uninitialized Constant Carrierwave::Storage::Fog
# Before
CarrierWave.configure do |config|
config.storage = :fog
config.fog_credentials = {
:provider => "AWS",
:aws_access_key_id => ENV["S3_KEY"],
:aws_secret_access_key => ENV["S3_SECRET"],
:region => ENV["S3_REGION"]
}
config.fog_directory = ENV["S3_BUCKET"]