Skip to content

Instantly share code, notes, and snippets.

Jagan Reddy reddyonrails

Block or report user

Report or block reddyonrails

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
reddyonrails / rspec_model_testing_template.rb
Created Nov 8, 2019 — forked from kyletcarlson/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
reddyonrails / nested-redis.rb
Created Nov 6, 2019 — forked from Loupi/nested-redis.rb
Redis Nested Comments in Ruby
View nested-redis.rb
require 'redis'
require 'json'
class CommentsRepository
def initialize
@redis =
def save(itemId, comment, parentId = nil)
reddyonrails / git
Last active Aug 20, 2019
Delete merged branches (locally)
View git
$ git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d && git remote prune origin
reddyonrails / FactoryBot
Created Sep 10, 2018
FactoryBot for development
View FactoryBot
`require 'factory_bot'`
View async_generator.js
async function *getRecords() {
const initialResponse = await getRecords();
let nextPage = initialResponse.pagination_token;
while(nextPage) {
const response = await getRecords(nextPage);
nextPage = response.pagination_token;
View es6mixin.js
var Bar1 = base => class extends base {
var Bar2 = base => class extends base {
reddyonrails / self_chain.rb
Created Apr 15, 2018
use instance methods with self for method chaining
View self_chain.rb
class Module
def with_chain(&block)
m =
m.methods(false).each do |name|
define_method name do
View gist:847bfdbe26f5c597189b78f9d771f077
Verifying my Blockstack ID is secured with the address 15AxSKrwo7Cwnzqa9Zq2T6iB2GpYKVAYDw
redis-cli --raw keys 'namespace:*'|xargs -L1 redis-cli del
reddyonrails / rspec_custom_macro.rb
Last active May 12, 2017
Rspec custom macro like let or let! => pass multiple keys to define array of lets under example group
View rspec_custom_macro.rb
module RSpec
module Core
module MemoizedHelpers
module ClassMethods
# Usage: ways of defining config getters
# Before:
# let!(:user_1) { DataSource.get(:user_1) }
# let!(:user_2) { DataSource.get(:user_2) }
# After:
You can’t perform that action at this time.