Skip to content

Instantly share code, notes, and snippets.

@nikneroz
nikneroz / Guardian JWT.md
Last active Mar 1, 2021
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.
View Guardian JWT.md

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf

Let's generate User model and controller.

@nikneroz
nikneroz / authorization.ex
Created Dec 11, 2017
Elixir + Phoenix Framework 1.3 + Guardian 1.0 + JWT(Refresh, Revoke, Recover) + Comeonin
View authorization.ex
# Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin
### User model bootstrap
Let's generate User model and controller.
```bash
mix ecto.create # create DB table
mix phx.gen.json Accounts User users email:string password_hash:string # scaffold users structure
```
@nikneroz
nikneroz / redux_saga.md
Last active Aug 27, 2020
Лекция №3: Redux-Saga
View redux_saga.md
API_CALL_REQUEST описывает что мы начинаем процесс получения данных с API
API_CALL_SUCCESS описывает что store успешно получил данные и процесс получения данных завершен
API_CALL_FAILURE описывает что API вызов завершился ошибкой
@nikneroz
nikneroz / tutorial.md
Last active Nov 16, 2019
JS, React, Webpack
View tutorial.md

JS

Webpack

@nikneroz
nikneroz / react_redux.md
Last active Nov 16, 2019
Лекция №2: React & Redux.
View react_redux.md

React

Функциональные и классовые компоненты

const WelcomeComponent = (props) =>
  <h1>Hello, {props.name}</h1>
class WelcomeComponent extends React.Component {
@nikneroz
nikneroz / Phoenix JWT.md
Last active Oct 13, 2019
Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin
View Phoenix JWT.md

Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin

User model bootstrap

Let's generate User model and controller.

mix ecto.create
mix phoenix.gen.json Accounts User users email:string password_hash:string
View Cassandra DB.md

What is Cassandra DB?

Cassandra is written in Java and was open-sourced by Facebook in July 2008. This original version of Cassandra was written primarily by an ex-employee from Amazon and one from Microsoft. It was strongly influenced by Dynamo, Amazon’s pioneering distributed key/value database. Cassandra implements a Dynamo-style replication model with no single point of failure, but adds a more powerful “column family” data model.

Cassandra has become so popular because of its outstanding technical features. It isdurable, seamlessly scalable, and tuneably consistent. It performs blazingly fast writes, can store hundreds of terabytes of data, and is decentralized and symmetrical so there’sno single point of failure. It is highly available and offers a schema-free data model

Where Can I use Cassandra DB?

  • Large-scale, high-volume websites, such as Web 2.0 social applications
  • High-performance, decentr
@nikneroz
nikneroz / planning.md
Last active Jun 2, 2019
Migration Plan
View planning.md

Auth ~ 1-2 weeks

Estimations

  • Base logic ~ 1 week
  • Controllers/Views/Mailers ~ 1 week

Authentication:

Library

@nikneroz
nikneroz / puma.rb
Created May 30, 2019
Ubuntu Rails deployments(RVM, Puma, Mina, Nginx)
View puma.rb
#!/usr/bin/env puma
# start puma with:
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
# threads_count = ENV.fetch("RAILS_MAX_THREADS") { 16 }
rails_env = 'production'
app_path = '/home/deploy/my_app'
current_path = "#{app_path}/current"
@nikneroz
nikneroz / init.vim
Last active May 5, 2019
Neovim config
View init.vim
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
set clipboard=unnamed
set modifiable
" Required: