Skip to content

Instantly share code, notes, and snippets.

View kuldeepaggarwal's full-sized avatar
🌎
Working hard

Kuldeep Aggarwal kuldeepaggarwal

🌎
Working hard
View GitHub Profile
@kuldeepaggarwal
kuldeepaggarwal / solve-git-problem
Created December 10, 2020 18:37 — forked from xiaoda/solve-git-problem
Solve 'Auto packing the repository in background for optimum performance' Problem
git fsck --lost-found
git gc --prune=now
@kuldeepaggarwal
kuldeepaggarwal / 17415.rb
Created October 28, 2014 16:03
Issue 17415
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.1.6'
gem 'pg', '~> 0.17.1'
gem 'minitest'
GEMFILE
system 'bundle'
end
@kuldeepaggarwal
kuldeepaggarwal / has_many_through.rb
Last active August 29, 2015 14:06
Has Many through, dependent: :destroy
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'arel', github: 'rails/arel', branch: 'master'
gem 'sqlite3'
gem 'minitest'
GEMFILE
system 'bundle'
end
@kuldeepaggarwal
kuldeepaggarwal / inverse_of.rb
Last active August 29, 2015 14:06
Inverse Of
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.1.5'
gem 'sqlite3', '~> 1.3.9'
gem 'minitest'
GEMFILE
system 'bundle'
end
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.2'
require 'active_record'
require 'debugger'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
@kuldeepaggarwal
kuldeepaggarwal / #13402.rb
Last active January 2, 2016 12:49
PG: When AR is aware about time_zone then timestamp field don't work if it can store values(like array),
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'pg'
GEMFILE
system 'bundle'
end
@kuldeepaggarwal
kuldeepaggarwal / gist:8059768
Last active December 31, 2015 23:19
AR PG timestamp error #13402
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'pg'
GEMFILE
system 'bundle'
end
@kuldeepaggarwal
kuldeepaggarwal / gist:8026843
Last active December 31, 2015 18:29
Rails Issue#13378
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'pg'
GEMFILE
system 'bundle'
end
@kuldeepaggarwal
kuldeepaggarwal / gist:7819494
Created December 6, 2013 06:33
Difference between ranges and array
require "benchmark"
char_collection = Hash.new (0)
TIMES = 10000
input_string = "123ABc ifuy fdtgbj\h vhkkkktvcv_*^%$# yku13234"
lowercase = ('a'..'z').to_a
uppercase = ('A'..'Z').to_a
digits = ('0'..'9').to_a
lcase = ('a'..'z')
@kuldeepaggarwal
kuldeepaggarwal / gist:7697489
Created November 28, 2013 20:08
accessing constants and create string at run time
require 'benchmark'
require 'benchmark/ips'
QUOTED_TRUE = "'t'"
def quoted_true
QUOTED_TRUE
end
def quoted_true_