Skip to content

Instantly share code, notes, and snippets.

View panvourtsis's full-sized avatar

Panagiotis Vourtsis panvourtsis

View GitHub Profile
import ReactExampleWidget from "reactexample/Widget";
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
module.exports = {
mode: "development",
devServer: {
port: 8080,
},
plugins: [
new ModuleFederationPlugin({
name: "container",
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
module.exports = {
entry: "./src/index",
mode: "development",
devServer: {
port: 8081,
},
plugins: [
[
"code janitor",
"crack",
["djinn", "jinniyah"],
"engineer",
"expert",
"freddy mercury of code",
"full time nerd",
"fullstack developer",
"genie",
const fetchUserEpic = (action$: ActionsObservable<UserActionTypes>) =>
action$.pipe(
ofType(FETCH_USER_REQUEST),
switchMap(() =>
from(API.fetch()).pipe(
mergeMap(data => of(setUserInfo(data))),
catchError(() => of(unsetUserInfo()))
)
)
);
import { SET_USER, SET_USER_TOKEN, UNSET_USER, UserActionTypes } from './types';
import { User } from './types';
const initialState: User = {
id: null,
name: '',
email: '',
};
function userInfo(state = initialState, action: UserActionTypes): User {
export const SET_USER_TOKEN = 'SET_USER_TOKEN';
export interface SetUserTokenAction {
type: typeof SET_USER_TOKEN;
payload: string;
}
export type UserActionTypes =
| SetUserTokenAction
| ActionB // other action
import {
SET_USER_TOKEN,
SetUserTokenAction,
} from './types';
import { simpleAction } from '../utils';
export const setUserToken = (token: string): SetUserTokenAction =>
simpleAction(SET_USER_TOKEN, token);
@panvourtsis
panvourtsis / panResponderExample.js
Last active June 12, 2019 09:36
RN-PanResponser
import React from 'react';
import { Animated } from 'react-native';
const PanExample = () => {
const panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => true, // we are enabling pan responder on start with this. So now we can listen tap and move
onPanResponderMove: (evt, gestureState) => {
// here we are listening every move
// evt and gestureState simply returns the x,y of the movement position
console.log('yes we are moving', gestureState.dy, gestureState.dx);
import { from, of, concat } from 'rxjs';
import { catchError, mergeMap, switchMap, takeUntil } from 'rxjs/operators';
import { startSubmit, stopSubmit } from 'redux-form';
const exampleEpic = action$ =>
action$.pipe(
ofType(types.ACTION_REQUEST),
switchMap(({ payload, meta }) => // yes, meta!
concat(
of(startSubmit(meta.formName)), // Here we define that this specific form is submitting