Skip to content

Instantly share code, notes, and snippets.

View savelichalex's full-sized avatar

Alexey Savelev savelichalex

View GitHub Profile
@savelichalex
savelichalex / go.js
Last active October 8, 2015 19:21
channels
var chan = function () {
return [];
};
var toString = Object.prototype.toString;
function go( machine, chan ) {
var gen = machine( chan );
_go( gen, gen.next() );
}
@savelichalex
savelichalex / Queue.js
Created November 18, 2015 23:00
Universal structure to allow communication between parent and child views
class Queue {
constructor( cb ) {
if( !cb ) {
throw new Error( 'You must specified callback');
}
this._cb = cb;
}
push( data ) {
this._cb( data )
@savelichalex
savelichalex / lazy.js
Created December 26, 2015 10:24 — forked from kana/lazy.js
Lazy evaluation in JavaScript
function delay(expressionAsFunction) {
var result;
var isEvaluated = false;
return function () {
if (!isEvaluated)
result = expressionAsFunction();
return result;
};
}
@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;
This is test row
@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 {
#!/bin/bash
for i in "$@"
do
case $i in
-p=*|-path=*)
find "./${i#*=}" -type file -exec /bin/cp {} $(pwd) \;
rm -rf "./${i#*=}";
;;
*)
#unknown option

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
class Either<T> {
right: ?T
left: ?string
constructor(right: ?T, left: ?string) {
this.right = right;
this.left = left;
}
static right<U>(data: U) {
(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)))]