Skip to content

Instantly share code, notes, and snippets.

View dineshpanda's full-sized avatar
🏠
Working from home

Dinesh Panda dineshpanda

🏠
Working from home
View GitHub Profile
require 'active_support/inflector'
require 'benchmark'
class James
end
class John
end
class Jimmy
brew install postgresql
/opt/homebrew/bin/createuser -s postgres
su - postgres
@dineshpanda
dineshpanda / gist:0564d7b410e98a11f6db3bef402c6996
Created September 9, 2021 05:26
postgres connection issue in mac m1
rm -rf /opt/homebrew/var/postgres/postmaster.pid
Ref: https://stackoverflow.com/questions/39710384/cannot-connect-to-postgres-server-running-through-brew-services
@dineshpanda
dineshpanda / mapDispatchToProps.md
Created July 19, 2021 07:55 — forked from heygrady/mapDispatchToProps.md
Redux containers: mapDispatchToProps

Redux containers: mapDispatchToProps

This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps argument of the connect function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps can take.

@dineshpanda
dineshpanda / git_squash
Created July 12, 2021 14:02
Squash commits keeping commit messages
git reset --soft HEAD~n && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
* n is the number of commits you want to squash from HEAD
@dineshpanda
dineshpanda / python_installation.txt
Last active April 24, 2019 11:09
Steps To Install Python 3.7 In CentOS 7.6
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar xzf Python-3.7.3.tgz
cd Python-3.7.3
./configure --enable-optimizations --prefix=/opt/mount1/python37 # path where python3.7 will be installed
make altinstall
# enable python37 command
vi ~/.bashrc
alias python37='/opt/mount1/python37/bin/python3.7' # add this line to ~/.bashrc
@dineshpanda
dineshpanda / rspec_model_testing_template.rb
Created April 22, 2019 20:33 — 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:
@dineshpanda
dineshpanda / upgrade-postgres-9.5-to-9.6.md
Created October 16, 2018 20:18 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
wget http://mirrors.ibiblio.org/gnu/ftp/gnu/emacs/emacs-25.1.tar.xz
tar xJvfp emacs-25.1.tar.xz
cd emacs-25.1/
sudo yum -y install libXpm-devel libjpeg-turbo-devel openjpeg-devel openjpeg2-devel turbojpeg-devel giflib-devel libtiff-devel gnutls-devel libxml2-devel GConf2-devel dbus-devel wxGTK-devel gtk3-devel libselinux-devel gpm-devel librsvg2-devel ImageMagick-devel
./configure
make
sudo make install