Skip to content

Instantly share code, notes, and snippets.

View korolr's full-sized avatar
:shipit:
¯\_(ツ)_/¯

Alexsey Ramzaev korolr

:shipit:
¯\_(ツ)_/¯
View GitHub Profile
@korolr
korolr / elm-dmy-fr.md
Created August 14, 2019 12:18 — forked from rlefevre/elm-dmy-fr.md
Elm using elm.dmy.fr proxies

Disclaimer: These proxies and instructions are not from the Elm team. I'm just a community member..


Here is how to use the proxies:

Packages documentation

Two options:

1. Browse elm.dmy.fr instead of package.elm-lang.org

@korolr
korolr / index.ts
Created December 11, 2018 19:09 — forked from vvakame/index.ts
TypeScript + Redux なアレ(React+Redux 3日やってみはじめて期限に間に合わないと判断し作業をやめた人なので信頼性があるかは申し訳ないですが謎です…
import { createStore, applyMiddleware, combineReducers } from "redux";
import thunk from "redux-thunk";
import { userReducer, UserAction, UserState } from "./user";
import { handshakeReducer, HandShakeAction, HandshakeState } from "./handshake";
import { productInfoReducer, ProductInfoAction, ProductInfoState } from "./product";
import { circleReducer, CircleAction, CircleState } from "./circle";
export const store = createStore(combineReducers({
user: userReducer,
@korolr
korolr / A Nuxt.js VPS production deployment.md
Created November 19, 2018 10:12 — forked from DreaMinder/A Nuxt.js VPS production deployment.md
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger then a landing page.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

1.Initial setup.

Redux WebSocket Middleware: Example

This Gist provides some code examples of how to implement WebSocket stream handling using a Redux middleware. Please be aware that this is only provided as an example and that critical things like exception handling have not been implemented.

A more complete version has been packaged, tested, and is available on GitHub as redux-websocket. This library has also been published to npm at @giantmachines/redux-websocket.

Middleware

This module represents the foundation of the middleware and implements the ideas presented above. The exported function is used during the creation of the Redux store (see the following snippet).

@korolr
korolr / tokens.md
Created September 2, 2018 08:53 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

@korolr
korolr / index.js
Created November 18, 2017 11:37 — forked from JonathanMH/index.js
JSON Web Token Tutorial: Express
// file: index.js
var _ = require("lodash");
var express = require("express");
var bodyParser = require("body-parser");
var jwt = require('jsonwebtoken');
var passport = require("passport");
var passportJWT = require("passport-jwt");
import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, combineReducers } from 'redux'
import * as R from 'ramda'
// composition helper
const combine = R.curry((c, o) => x => (<div>{c(x)} {o(x)}</div>))
const combineComponents = (...args) => {
const [first, ...rest] = args
return R.reduce((acc, c) => combine(acc, c), first, rest)