Skip to content

Instantly share code, notes, and snippets.

View savelichalex's full-sized avatar

Alexey Savelev savelichalex

View GitHub Profile
@savelichalex
savelichalex / sector.js
Last active June 23, 2017 05:11
react native art sector
import {
ART,
Platform,
} from 'react-native';
const {
Surface,
Group,
Shape,
Path,
} = ART;
import React, { Component } from 'react';
class Input extends Component {
static state = {
curPos: null,
}
componentDidUpdate() {
const {
curPos,
import React, { Component, PropTypes, cloneElement } from 'react';
const listeners = {};
let id = 0;
window.addEventListener(
'resize',
(event) => {
for (let id in listeners) {
(defmacro then->
[promise & forms]
(loop [promise promise,
forms forms]
(if forms
(let [form (first forms)
catch? (= form :catch)
threaded (if (true? catch?)
(with-meta `(.catch ~promise ~(first (next forms))) (meta (first (next forms))))
(with-meta `(.then ~promise ~form) (meta form)))]
class Either<T> {
right: ?T
left: ?string
constructor(right: ?T, left: ?string) {
this.right = right;
this.left = left;
}
static right<U>(data: U) {

Copy link

curl https://gist.githubusercontent.com/savelichalex/fe80dc3f1a1ca6c633010578d92b030a/raw/1e9c22c58e2c2d9b3987d5fa5289670e2ae6ce92/ungroup-folder.sh > /usr/local/bin/ungroup-folder && chmod a+x /usr/local/bin/ungroup-folder

to terminal

Then go in terminal to folder where you want to ungroup Ie if you want to ungroup folder foo in /Documents

cd ~/Documents
#!/bin/bash
for i in "$@"
do
case $i in
-p=*|-path=*)
find "./${i#*=}" -type file -exec /bin/cp {} $(pwd) \;
rm -rf "./${i#*=}";
;;
*)
#unknown option
@savelichalex
savelichalex / LinkedList.js
Last active June 8, 2016 12:56
TwoWayLinkedList
'use strict';
/**
* Represent node in two way linked list.
* Totally incomprehensible rand field, that produce circular links for list
* List is data structure that allows walk around list, specially two way linked list
* help to walk from tail. With rand field serialize and
* deserialize have O(n * 2) instead O(n)
*/
class ListNode {
This is test row
@savelichalex
savelichalex / LazySequence.js
Last active December 26, 2015 17:09
Lazy Sequence and functions to work with this
'use strict';
/**
* Dalay expressions evaluation
* @param expressionAsFunc {Function}
* @returns {Function} thunk
*/
function delay(expressionAsFunc) {
let result;
let isEvaluated = false;