Skip to content

Instantly share code, notes, and snippets.

Working from home

Arup Rakshit aruprakshit

Working from home
Block or report user

Report or block aruprakshit

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
aruprakshit /
Created Nov 20, 2018 — forked from heygrady/
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.


Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
View database.yml
adapter: postgresql
encoding: utf8
database: campflame_development
pool: 5
host: ''
adapter: postgresql
encoding: utf8
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
aruprakshit / 000_postgresql_fancy_datatypes
Created Oct 8, 2015 — forked from pcreux/000_postgresql_fancy_datatypes
Postgresql fancy datatypes with Rails / ActiveRecord. Run it with `rake`!
View 000_postgresql_fancy_datatypes
# Postgresql fancy datatypes!
* array
* hstore (=~ hash)
* json
* jsonb
Philippe Creux - [@pcreux](
aruprakshit /
Last active Aug 29, 2015 — forked from jexchan/
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C ""
aruprakshit / import.rake
Last active Aug 29, 2015
Rake task to import data from text file to Postgresl table.
View import.rake
desc "import task"
task :import, [:username, :password, :dbname, :path] do |t, args|
sh <<-SQL
PGPASSWORD=#{args[:password]} psql --username=#{args[:username]} --dbname=#{args[:dbname]} << EOF
\\copy films from #{args[:path]} (DELIMITER E'\t');
aruprakshit /
Last active Aug 29, 2015
Git and Bash shell customizations

Get the script here. Put it somewhere like ~/ If you want to be all CLI about it, you could just run:

curl -o ~/

Now modify your your bash profile (it’s at ~/.bash-profile, in case you’re new to this stuff). Before the part of the file that declares what your prompt will look like (PS1=[...]), load in the script you just downloaded, like so:

# Load in the git branch prompt script.
View chain-of-responsibility.rb
class PurchaseApprover
# Implements the chain of responsibility pattern. Does not know anything
# about the approval process, merely whether the current handler can approve
# the request, or must pass it to a successor.
attr_reader :successor
def initialize successor
@successor = successor
You can’t perform that action at this time.