Skip to content

Instantly share code, notes, and snippets.

View swapnil-webonise's full-sized avatar

Swapnil Patil swapnil-webonise

  • Haptiq
  • Pune, India
View GitHub Profile
@swapnil-webonise
swapnil-webonise / epic.ts
Created July 23, 2019 13:44
Actions with redux-observable
import { ofType } from 'redux-observable';
import { map, switchMap, takeUntil } from 'rxjs/operators';
import { Actions } from '../constants/action-constant';
import { ajax } from 'rxjs/ajax';
import { fetchNextRaceFulfill, onRaceListSuccess } from '../actions/racing-action';
import apiConstant from '../constants/api-constant';
import { Race, RaceData } from '../types/racing';
export const fetchNextToRaceEpic = (action$: any) => action$.pipe(
ofType(Actions.FETCH_NEXT_RACE),
1) sudo apt-get update
2) sudo apt-get install curl
3) \curl -L https://get.rvm.io | bash -s stable
4) add following line to ~/.bash_profile
and ~/.profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
4) After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.
source ~/.rvm/scripts/rvm
5) In order to work, RVM has some of its own dependancies that need to be installed. To automatically install them:
rvm requirements
@swapnil-webonise
swapnil-webonise / .eslintrc
Created June 16, 2017 09:11
Eslint with react plugin settings
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"node": true,
@swapnil-webonise
swapnil-webonise / stroage-provider.js
Created March 23, 2017 11:33
Browser Storage - Handling localstorage, sessionStorage, cookie and alternativeStorage if storage not available
function Storage() {
}
function SessionStorageProvider() {
try {
sessionStorage.setItem("storage", "");
sessionStorage.removeItem("storage");
this.storage = sessionStorage;
} catch (err) {
this.storage = new LocalStorageAlternative();
@swapnil-webonise
swapnil-webonise / JavaScript apply vs. call vs. bind.md
Last active November 15, 2016 13:32
JavaScript apply vs. call vs. bind

JavaScript has three different methods that allow you to change the value of this for a given function.

Those methods are Function.prototype.call(), Function.prototype.apply() and Function.prototype.bind().

Methods

  1. call invokes the function and allows you to pass in arguments one by one.

  2. apply invokes the function and allows you to pass in arguments as an array.

  3. bind returns a new function, allowing you to pass in a this array and any number of arguments.

@swapnil-webonise
swapnil-webonise / Mongo Db import and export command.md
Last active June 21, 2016 05:32
Mongo Db import and export command

Database dump

mongodump --db dbname --out op.json

Database restore

mongorestore --db mongodevdb op.json/dbname/

Edit .bashrc file and add following code to it

sudo vim ~/.bashrc

Code

parse_git_branch() {
 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then

PS1='${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[01;31m]$(parse_git_branch)[\033[00m]$ '

@swapnil-webonise
swapnil-webonise / Sublime user presences settings.md
Last active March 21, 2016 09:27
Sublime user presences settings

Go to -> "Preferences > settings-user" and paste following settings

Settings

{
	"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
	"draw_white_space": "all",
	"font_size": 11,
	"ignored_packages":

[

@swapnil-webonise
swapnil-webonise / Setting up Karma with Mocha, PhantomJS and Chai
Last active March 21, 2016 08:52
Setting up Karma with Mocha, PhantomJS and Chai
# Setting up Karma with Mocha, PhantomJS and Chai
@swapnil-webonise
swapnil-webonise / Ruby Basics Assignment
Last active March 21, 2016 09:13
Ruby Basics Assignment
require "active_support/core_ext/integer/inflections"
def sum_of_cubes(upto)
sum = 0
(1..upto).each do |num|
sum += num ** 3
end
return sum
end