Skip to content

Instantly share code, notes, and snippets.

Writing code

Junil Jacob JunilJacob

Writing code
View GitHub Profile
JunilJacob / base_controller.rb
Last active Oct 23, 2019
Request Rate Limiter
View base_controller.rb
class Api::V3::BaseController < ActionController::Base
include Limiter
before_action -> { rate_limit(key: "api_#{doorkeeper_token.application_id}", rate: 60, interval: 60) }
def handle_rate_limit_exception
log_exception"Rate limit reached for #{}")
render json: { error: { type: "rate_limit_exceeded", message: "Rate limit exceeded." } }, status: 429
JunilJacob / totp_2fa.rb
Created May 31, 2019 — forked from Nitrino/totp_2fa.rb
Rails mixin module for Two Factor Authentication (TOTP)
View totp_2fa.rb
module OneTimePassword
# Concern containing logic and methods for OTP authentication.
# Is used Time-based One-time Password Algorithm(TOTP)
extend ActiveSupport::Concern
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
JunilJacob / gist:7a6dd1dae2b4da2d79ad93c98f2cab33
Created Aug 8, 2017 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:7a6dd1dae2b4da2d79ad93c98f2cab33


:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
JunilJacob /
Created Jun 17, 2017 — forked from awilliams/
Delete multiple grepable tags from git
for i in $( git tag -l | grep staging ); do
echo Tag: $i
#git tag -d $i
#git push origin :refs/tags/$i
JunilJacob / git-merge-tool
Created Mar 18, 2017 — forked from coderxin/git-merge-tool
How to set Sublime Text 2 as Git merge tool?
View git-merge-tool
git config --global mergetool.sublime.cmd "subl -w \$MERGED"
git config --global mergetool.sublime.trustExitCode false
git config --global merge.tool sublime
git mergetool -y
JunilJacob / gist:261df8a1a9f743c6382ebfab7027a73e
Created Jun 8, 2016 — forked from ericallam/gist:1019446
How to log all queries for a PostgreSQL homebrew install on OS X
View gist:261df8a1a9f743c6382ebfab7027a73e

Open the postgresql.conf config file:

$> mate /usr/local/var/postgres/postgresql.conf

Uncomment the line with 'log_destination' and set it to 'syslog'

log_destination = 'syslog'

Open the syslog config:

View Devise login from rails console
ApplicationController.allow_forgery_protection = false'/users/sign_in', {"users"=>{"email"=>"", "password"=>"password"}})
JunilJacob /
Last active Aug 29, 2015 — forked from pixelhandler/
Git pre-push hook to prevent force pushing master branch
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
# If this script exits with a non-zero status nothing will be pushed.
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
You can’t perform that action at this time.