Skip to content

Instantly share code, notes, and snippets.


Irfan Ahmed rubyrider

  • Lodz, Poland
Block or report user

Report or block rubyrider

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View documentation_example.rb
require_relative 'postman/email_base'
require_relative 'postman/mail_gun_postman'
require_relative 'postman/custom_sms_gateway'
module Janao
module Postman
# Sets list of allowed email adapters
'MailGun' => MailGunPostman
rubyrider / # qt - 2018-10-07_16-01-34.txt
Created Oct 7, 2018
qt on macOS 10.14 - Homebrew build logs
View # qt - 2018-10-07_16-01-34.txt
Homebrew build logs for qt on macOS 10.14
Build date: 2018-10-07 16:01:34
rubyrider / .rubocop.yml
Created Sep 19, 2018
Rubocop Configuration for Rails
View .rubocop.yml
require: rubocop-rspec
Enabled: true
# Commonly used screens these days easily fit more than 80 characters.
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
View Refinement example
# Original AFooClass
class AFoo
def bar
puts "Foooo Bar"
# Refining Module
module RefiningAFoo
View mix_array_flattener.rb
# Module MixArrayFlattener
# Add #flatten_array to Array for the purpose
# of flatten nested array
module MixArrayFlattener
InvalidArrayItemFound =
# Flatten nested array!
# @return single flat array,
View A piece of reduced code to build a crawler!
con ='') do |config|
config.build_page do |page|
page.content_identifier = 'a.faclink'
page.url = ''
page.build_details 'Bablon College' do |details|
details.department = '.bio_facultytitle > h3' = 'span[class*=name_]' = 'a[href*=mailto]' = '.ms-rtestate-field > img'
View Active Admin belongs to filter with custom foreign key
module ActiveAdmin
module Filters
# This form builder defines methods to build filter forms such
# as the one found in the sidebar of the index page of a standard resource.
class FormBuilder < ::ActiveAdmin::FormBuilder
include ::ActiveAdmin::Filters::FormtasticAddons
self.input_namespaces = [::Object, ::ActiveAdmin::Inputs::Filters, ::ActiveAdmin::Inputs, ::Formtastic::Inputs]
# TODO: remove input class finders after formtastic 4 (where it will be default)
self.input_class_finder = ::Formtastic::InputClassFinder
rubyrider / Just Snippets
Created Dec 28, 2014
Sort Post by date!
View Just Snippets
# in controller#action
@posts = Post.all.group_by(&:created_at)
# view
<% @posts.each do |date, posts | %>
<h2><%= date.strftime("#{} %B,%Y") %></h2>
<% posts.each do | post | %>
<td><%= post.what_ever_column_you_need %></td>
<% end %>
View Rspec Code example
describe 'EducationRecord' do
let(:user) {users(:john)}
let(:candidate) {candidates(:john_candidate)}
before do
cookies[:user_auth_token] = encrypt_token(user.access_token)
around(:each) do |example|
VCR.use_cassette(:get_user_from_sso, {}, &example)
rubyrider / event.rb
Last active Aug 29, 2015
Event Fetching Process
View event.rb
module FetchEvent
extend ActiveSupport::Concern
def fetch_additional_photo
@offset, limit, fixed = 50, 50, 50
excluding_pid_lists = [].join(',')
0.upto(@offset) do |i|
increment = (fixed*i)
You can’t perform that action at this time.