Skip to content

Instantly share code, notes, and snippets.

View rubyrider's full-sized avatar
🎯
Focusing

Irfan Ahmed rubyrider

🎯
Focusing
View GitHub Profile
/*! debug.css | MIT License | zaydek.github.com/debug.css */
*:not(path):not(g) {
color: hsla(210, 100%, 100%, 0.9) !important;
background: hsla(210, 100%, 50%, 0.5) !important;
outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important;
box-shadow: none !important;
}
@rubyrider
rubyrider / documentation_example.rb
Created October 8, 2018 17:46
Documentation example
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
EMAIL_ADAPTERS = {
'MailGun' => MailGunPostman
@rubyrider
rubyrider / # qt - 2018-10-07_16-01-34.txt
Created October 7, 2018 10:43
qt on macOS 10.14 - Homebrew build logs
Homebrew build logs for qt on macOS 10.14
Build date: 2018-10-07 16:01:34
@rubyrider
rubyrider / .rubocop.yml
Created September 19, 2018 07:46
Rubocop Configuration for Rails
require: rubocop-rspec
Rails:
Enabled: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# Original AFooClass
class AFoo
def bar
puts "Foooo Bar"
end
end
# Refining Module
module RefiningAFoo
# Module MixArrayFlattener
# Add #flatten_array to Array for the purpose
# of flatten nested array
module MixArrayFlattener
InvalidArrayItemFound = Class.new(StandardError)
# Flatten nested array!
#
# @return single flat array,
con = CrawlerBase.build('http://www.babson.edu') do |config|
config.build_page do |page|
page.content_identifier = 'a.faclink'
page.url = 'http://www.babson.edu/Academics/faculty/profiles/Pages/default.aspx'
page.build_details 'Bablon College' do |details|
details.department = '.bio_facultytitle > h3'
details.name = 'span[class*=name_]'
details.email = 'a[href*=mailto]'
details.photo = '.ms-rtestate-field > img'
end
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
rubyrider / Just Snippets
Created December 28, 2014 00:54
Sort Post by date!
# in controller#action
@posts = Post.all.group_by(&:created_at)
# view
<% @posts.each do |date, posts | %>
<h2><%= date.strftime("#{date.day.ordinalize} %B,%Y") %></h2>
<tr>
<% posts.each do | post | %>
<td><%= post.what_ever_column_you_need %></td>
<% end %>
describe 'EducationRecord' do
let(:user) {users(:john)}
let(:candidate) {candidates(:john_candidate)}
before do
cookies[:user_auth_token] = encrypt_token(user.access_token)
end
around(:each) do |example|
VCR.use_cassette(:get_user_from_sso, {}, &example)