Skip to content

Instantly share code, notes, and snippets.

View raihan2006i's full-sized avatar

Miah Raihan Mahmud Arman raihan2006i

  • Manchester, United Kingdom
View GitHub Profile
@raihan2006i
raihan2006i / Gemfile
Created May 6, 2019 12:30 — forked from UsamaAshraf/Gemfile
N+1 Queries, Batch Loading and Active Model Serializers
# ...
# https://github.com/exAspArk/batch-loader
gem 'batch-loader'
@raihan2006i
raihan2006i / poc-openssl-aes.rb
Created June 5, 2018 11:48 — forked from dirtyhenry/poc-openssl-aes.rb
Encryption interoperability demo between Ruby and OpenSSL
require 'openssl'
require 'base64'
# Read the dummy file
data = File.read("test.txt")
# Create an encrypter
cipher = OpenSSL::Cipher::AES.new(256, :CBC)
cipher.encrypt
key = cipher.random_key

Ruby Association Certified Ruby Examination Gold Sample Questions

Q1. Assume that the following code must have the stated execution result.

__(1)__
x.each_line { |line| puts line }

[Execution Result]
apple

Ruby Association Certified Ruby Examination Silver Sample Questions

Q1. Which of the following have true values in Ruby? (Choose two.)

  • (a) ""
  • (b) 0
  • (c) false
  • (d) nil

@raihan2006i
raihan2006i / downgrade.sh
Created October 17, 2016 18:44 — forked from 1v/downgrade.sh
Apache 2.2.22 + PHP 5.3.10 on Ubuntu 14.04
cat <<EOF >> /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu precise main restricted universe
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
EOF
apt-get update
apt-get remove \
apache2 \
@raihan2006i
raihan2006i / le-renew.sh
Last active February 16, 2016 17:08 — forked from benyanke/le-renew.sh
Auto renewal for Let's Encrypt Apache
#!/bin/bash
#================================================================
# Let's Encrypt renewal script for Apache/Nginx on Ubuntu/Debian
# @author Erika Heidi<erika@do.co>
# Usage: ./le-renew.sh [base-domain-name]
# More info: http://do.co/1mbVihI
#================================================================
domain=$1
le_path="/opt/letsencrypt"
le_conf='/etc/letsencrypt'
@raihan2006i
raihan2006i / index.html.haml
Last active January 3, 2016 14:29 — forked from henrik/will_paginate.rb
bootstrap 3 and bootstrap 2 renderer for will_paginate
/ app/views/posts/index.html.haml
/ Centered pagination in Bootstrap 3.x
.text-center
= will_paginate @posts, {:class => 'pagination', :version => :bootstrap3 }
/ Centered pagination in Bootstrap 2.x
= will_paginate @posts, {:class => 'pagination pagination-centered', :version => :bootstrap2 }
// easy way to get current pages HTML
$.get('#', function(html) {
// emulate form post
var formData = new FormData();
formData.append('out', 'json');
formData.append('content', html);
// make ajax call
$.ajax({
@raihan2006i
raihan2006i / _form.html.haml
Last active December 21, 2015 16:48
Recently i have used recaptcha gem in one of my rails application with bootstrap form controls. Here i am sharing my codes, so that someone can get help from this.
/ app/views/posts/_form.html.haml
= simple_form_for(@post) do |f|
= f.error_notification
.form-inputs
= f.input :title
= f.input :content, :as => :text
= render 'shared/recaptcha'
.form-actions