Skip to content

Instantly share code, notes, and snippets.

View mozkoq's full-sized avatar

Nikolay Komarov mozkoq

View GitHub Profile
@mozkoq
mozkoq / .vimrc
Last active October 9, 2017 10:42
my vim config
let mapleader = ","
if &compatible
set nocompatible " Be iMproved
endif
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
@mozkoq
mozkoq / .rclua
Last active October 9, 2017 10:47
awesomewm config
--[[
Awesome WM configuration template
github.com/copycat-killer
--]]
-- {{{ Required libraries
local awesome, client, screen, tag = awesome, client, screen, tag
@mozkoq
mozkoq / .zshrc
Last active October 9, 2017 10:44
.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/usr/share/oh-my-zsh
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# Set name of the theme to load. Optionally, if you set this to "random"
@mozkoq
mozkoq / nameGen.js
Last active May 2, 2017 12:41
russian name generator
const CONSONANT = "бвгджзклмнпрстфхцчшщ"
const VOWEL = "еёаиэюяоу"
const isFirst = i => i == 0
const isEven = n => (n % 2) == 0
const rand = n =>
Math.floor(Math.random() * n)
const randChar = string =>
@mozkoq
mozkoq / createStore.js
Created April 6, 2017 00:19
My create store
const createStore = (reducer, initialState) => {
let state = initialState
let listeners = []
const getState = () => state
const dispatch = action => {
state = reducer(state, action)
listeners.forEach(listener => listener())
}
@mozkoq
mozkoq / counter-redux.js
Last active March 28, 2017 15:02
redux example
const { createStore, combineReducers } = require('redux')
const ActionType = {
Inc: Symbol(),
Dec: Symbol(),
Pow: Symbol(),
}
const inc = () =>
({ type: ActionType.Inc })
@mozkoq
mozkoq / ageformater.js
Last active March 23, 2017 16:19
Simply russian age formater
const getLastNumbers = number => number % 100
const getLastNumber = number => number % 10
const inRange = (start, end, number) => number >= start && number <= end
const getNumberForm = number => {
@mozkoq
mozkoq / filter.js
Created March 20, 2017 17:39
filter js (reduce)
const filter = (pred, arr) => {
const DEFAULTSTATE = []
return arr.reduce(
(result, current, i, reducingArray) =>
pred(current, i, reducingArray)
? [...result, current]
: result,
DEFAULTSTATE
)
}
@mozkoq
mozkoq / map.js
Last active March 20, 2017 10:40
javascript map
const map = (fn, arr) => {
const DEFAULTSTATE = []
return arr.reduce(
(result, current, i, reducingArray) =>
[...result, fn(current, i, reducingArray)],
DEFAULTSTATE
)
}
@mozkoq
mozkoq / todo.js
Created March 17, 2017 12:02
yey it work
//xs.filter((el, i) => i != 0)*/
// {
// todos: [
// {
// id: 1,
// text: "first",
// status: "active",
// },
// {