Skip to content

Instantly share code, notes, and snippets.

View reddyonrails's full-sized avatar

Jagan Reddy reddyonrails

View GitHub Profile
// Store Redux
state = {
cars: {
carsById: {
1: { id: 1, name "Toyota" },
2: { id: 2, name "Lexus" },
3: { id: 3, name "Honda" }
}
}
};
// Store Redux
state = {
cars: {
carsById: {
1: { id: 1, name "Toyota" },
2: { id: 2, name "Lexus" },
3: { id: 3, name "Honda" }
}
}
};
@reddyonrails
reddyonrails / rspec_model_testing_template.rb
Created November 8, 2019 23:04 — forked from SabretWoW/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…
# 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
reddyonrails / nested-redis.rb
Created November 6, 2019 17:59 — forked from Loupi/nested-redis.rb
Redis Nested Comments in Ruby
require 'redis'
require 'json'
class CommentsRepository
def initialize
@redis = Redis.new
end
def save(itemId, comment, parentId = nil)
var Bar1 = base => class extends base {
componentWillMount(){
super.componentWillMount();
console.log('Bar1');
}
};
var Bar2 = base => class extends base {
componentWillMount(){
super.componentWillMount();
@reddyonrails
reddyonrails / postgres_queries_and_commands.sql
Created April 8, 2016 17:40 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@reddyonrails
reddyonrails / gist:11361991
Created April 28, 2014 04:44 — forked from dLobatog/gist:5853751
Ruby 2.0 curry function example
is_weekday = lambda {|day_of_week, time| time.wday == day_of_week}.curry
sunday = is_weekday[0]
monday = is_weekday[1]
tuesday = is_weekday[2]
wednesday = is_weekday[3]
thursday = is_weekday[4]
friday = is_weekday[5]
saturday = is_weekday[6]
#!/usr/bin/env ruby
# Please read http://otobrglez.opalab.com for more information about this code.
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
# DOCKER-VERSION 0.4.8
# am facing issue
# https://github.com/dotcloud/docker/issues/1123
FROM ubuntu:12.04
MAINTAINER Deepak Kannan "[email protected]"
RUN apt-get -y install python-software-properties
OK, Let's begin. Hello, Everybody.
My name is Narihiro Nakamura.
Today, I'm talking about "Parallel worlds of CRuby's GC".
I'm very happy now, because I'm meeting attendee in rubyconf.
And, one of my dreams is to talk in rubyconf.
So, I'm very happy and exciting.
Today is my first presentation in English.
My English is not good.