Skip to content

Instantly share code, notes, and snippets.

@nikneroz
nikneroz / hound.ex
Last active Jan 15, 2018
Use Hound for site scrapping
View hound.ex
config :hound, [driver: "chrome_driver"]
session = Hound.start_session()
navigate_to("https://hello.world")
:timer.sleep(7 * 1000)
json_tag = find_element(:tag, "pre")
json = inner_html(json_tag)
Hound.end_session(session)
@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 / 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
@nikneroz
nikneroz / docs.md
Created Sep 5, 2017
Mixfit API docs
View docs.md

MixFit prototype API

MixFit prototype API

Version: 1.0.0

/api/v1/me/{public-address}


GET

Summary: returns BioCoin balance and reward amount

@nikneroz
nikneroz / File Upload(S3).md
Created Aug 2, 2017
Elixir + Phoenix Framework 1.3 + FIle upload + S3 upload
@nikneroz
nikneroz / Guardian JWT.md
Last active Jul 31, 2017
Elixir + Phoenix Framework 1.3 + Guardian + JWT. This is tutorial and step by step installation guide.
View Guardian JWT.md

Elixir + Phoenix Framework 1.3 + Guardian + JWT + Comeonin

User model bootstrap

Let's generate User model and controller.

mix ecto.create
mix phoenix.gen.json Accounts User users email:string name:string phone:string password_hash:string is_admin:boolean
@nikneroz
nikneroz / Tutorial.md
Created Jul 20, 2017
Elixir + Phoenix Framework 1.3 + Sentinel. This is tutorial and step by step installation guide.
View Tutorial.md

Phoenix Framework 1.3 + Sentinel

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
@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 / win_init.vim
Last active Jul 8, 2018
Neovim & Windows WLS
View win_init.vim
if &compatible
set nocompatible
endif
" Required:
set runtimepath+=~/.config/nvim/dein/repos/github.com/Shougo/dein.vim
set runtimepath+=~/.config/nvim/dein/.cache/vim-airline/
set clipboard=unnamed
" Required:
@nikneroz
nikneroz / config.fish
Last active May 14, 2017
Fish git prompt
View config.fish
set normal (set_color normal)
set magenta (set_color magenta)
set yellow (set_color yellow)
set green (set_color green)
set red (set_color red)
set gray (set_color -o black)
# Fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'