Skip to content

Instantly share code, notes, and snippets.

View iofjuupasli's full-sized avatar

Valery iofjuupasli

  • fugo.ai
  • Warsaw, Poland
  • 09:35 (UTC +02:00)
View GitHub Profile
@iofjuupasli
iofjuupasli / manyToManyMap.js
Last active August 29, 2015 13:57
Mapping array of many-to-many entities to map with faster access
function manyToManyMap(source, first, second) {
'use strict';
var result = {}, i, item;
for (i = 0; i < source.length; i += 1) {
item = source[i];
if (!result[item[first]]) {
result[item[first]] = {};
}
result[item[first]][item[second]] = item;
}
/*jslint nomen: true, vars: true*/
/*global define*/
define(['jquery', 'lodash'], function ($, _) {
'use strict';
var FallbackCrud = (function () {
function Class() {
this.cruds = arguments;
}
_.forEach(['create', 'read', 'update', 'del'], function (method) {
@iofjuupasli
iofjuupasli / double-comma.sublime-macro
Created January 16, 2015 13:00
sublime text double comma\semicolon to end of string
[
{
"args":
{
"to": "eol"
},
"command": "move_to"
},
{
"args":
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=/home/$USER/local
make install
curl -O -L https://www.npmjs.org/install.sh | sh
@iofjuupasli
iofjuupasli / features.md
Last active August 29, 2015 14:16
Atom features wanted
  • Tree: goto
  • Tree: lint subtree
  • Rename file shortcut
function add(a) {return function(b){return a + b}}
function nEq(a) {return function(b){return a !== b}}
function eq(a) {return function(b){return a === b}}
function always(val) {return function(){return val}}
function id(a){return a}
function getPropertyValue(prop){
var val;
prop.take(1).onValue(function(_val){val = _val});
return val;
/*global React, flyd, R*/
(function () {
'use strict';
var Player = function (control) {
return function (players) {
var player = {};
var possibleNewPosition = flyd.stream([control.move], function () {
return (player.position() || 0) + control.move();
});
var canMove = flyd.stream([possibleNewPosition], function () {
iofjuupasli@iofjuupasli:~/projects/timeraven$ ssh root@188.166.101.74
The authenticity of host '188.166.101.74 (188.166.101.74)' can't be established.
ECDSA key fingerprint is 84:4f:ff:cf:95:a8:5a:d4:72:90:56:c9:6a:37:b6:b5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '188.166.101.74' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Fri Apr 24 02:49:47 EDT 2015
@iofjuupasli
iofjuupasli / async-in-js.md
Last active August 29, 2015 14:26
async graphs in js

Comparison of several ways of working with complex async graphs in js

  A     E
 /|\    |
B | C   F
 \|/
  D