Skip to content

Instantly share code, notes, and snippets.

View IrakliJani's full-sized avatar
🇬🇪

Irakli Janiashvili IrakliJani

🇬🇪
View GitHub Profile
@IrakliJani
IrakliJani / gist:2922d5f5c8242caa0220ed1d9a4dba3d
Created April 15, 2019 03:54
Git code move from repo A to repo B with history
git clone [repo-A-url] [repo-A-name]
cd [repo-A-name]
git checkout [branch-in-repo-A]
git remote rm origin
git filter-branch --subdirectory-filter [directory-to-move] -- --all
mkdir [folder-to-move]
mv * [folder-to-move] # mind the hidden files
git add --all
git commit
cd [repo-B-path]
@IrakliJani
IrakliJani / sergo.js
Created August 13, 2017 18:38
Sergo File Watcher
const path = require("path")
const fs = require("fs")
const endOfLine = require("os").EOL
// Config -
const fileDir = __dirname
const fileName = "in-file.txt"
const outFileDir = __dirname
const outFileName = "out-file.txt"
// library imports 😜 wink, wink
const identity = x => x
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))
function process (words, configs) {
const lengthFilter = length => word =>
Array.isArray(length)
? word.length >= length[0] && word.length <= length[1]
: word.length === length
@IrakliJani
IrakliJani / styled-native
Last active November 10, 2016 11:17
Styled Native
ActivityIndicator
@include: View
color: color
size: enum('small', 'large'), number
Button
color: color
DatePickerIOS
@include: View
@IrakliJani
IrakliJani / action_aliases.js
Created July 30, 2016 19:21
Action aliases in reducers
function linksReducer (state = Map(), action) {
switch (action.type) {
case CLOSE_LINK:
case REMOVE_LINK:
return state.delete(action.id)
...
}
}
@IrakliJani
IrakliJani / listening_actions.js
Created July 30, 2016 19:12
Listening actions in different reducers
function usersReducer (state = Map(), action) {
switch (action.type) {
...
case REMOVE_USER:
return state.delete(action.id)
...
}
}
function tasksReducer (state = Map(), action) {
@IrakliJani
IrakliJani / combine_reducers_1.js
Created July 30, 2016 19:01
Combine reducers
const rootReducer = combineReducers({
user: usersReducer,
task: combineReducers({
list: tasksReducer,
current: currentTaskReducer
})
})
function usersReducer (state = Map(), action) {
[...]
@IrakliJani
IrakliJani / reducer_immutable.js
Last active July 30, 2016 18:18
Reducer with immutable.js
function tasksReducer (state = Map(), action) {
switch (action.type) {
case ADD_TASK:
return state.set(action.task.id, action.task)
case REMOVE_TASK:
return state.delete(action.id)
case COMPLETE_TASK:
return state.updateIn([action.id, 'completed'], true)
import { applyMiddleware } from 'redux'
import { addAlert } from 'actions/Alert'
function errorHandler () {
return (next) => (action) => {
if (typeof action === 'function') {
return next(async function (dispatch, getState) {
try {
return await action(dispatch, getState)
} catch (error) {
@IrakliJani
IrakliJani / eslint.yml
Created October 28, 2015 00:46
My eslint configuration
env:
es6: true
browser: true
jquery: true
ecmaFeatures:
jsx: true
experimentalObjectRestSpread: true
blockBindings: true
plugins:
- react