Skip to content

Instantly share code, notes, and snippets.

View Skitionek's full-sized avatar

Dominik Maszczyk Skitionek

View GitHub Profile
const { spawn } = require('child_process');
const args = process.argv.slice(2);
const child = spawn('tree',['-f', '--', args[0] || '.']);
child.stdout.setEncoding('utf8');
child.stdout.on('data', (chunk) => {
const lines = chunk.split(/\n/g).filter(line=>line!==''&&!line.match(/^\d/));
lines.forEach(line=>console.log(line.replace(/([^ \n]*?)([^ /\n]*)$/,'[$2]($1$2)')));
});
@Skitionek
Skitionek / ZoomableTreemap.js
Created February 6, 2019 07:27
Neat *D3 v4 & React* Zoomable Treemap template
import React, {Component} from 'react';
import {format as d3format} from 'd3-format';
import {scaleLinear} from 'd3-scale';
import {hierarchy, treemap} from 'd3-hierarchy';
import styled from 'styled-components';
import {select} from "d3-selection";
import {sum} from 'd3-array';
import {nest} from 'd3-collection';
const StyledSVG = styled.svg`
@Skitionek
Skitionek / Invert.js
Created November 16, 2018 06:53
Invert website lightness
function rgbToHsl([r, g, b]) {
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if (max == min) {
h = s = 0; // achromatic
} else {
var d = max - min;
@Skitionek
Skitionek / git-status
Last active March 16, 2018 13:08
Recursive traverse folders finding the git repositories and listing the uncommitted changes. Additionally, if the pair with the same name was found compare them with git diff.
#!/usr/local/bin/bash
clear
# just for formatting
b=$(tput bold)
n=$(tput sgr0)
declare -A reppos
@Skitionek
Skitionek / SplitPane.js
Created November 6, 2017 07:37
Amazingly simple yet powerful, flex based Split Pane implementation (draggable!)
/**
* Created by Dominik Maszczyk (https://www.linkedin.com/in/dominik-maszczyk/)
* on 30/10/17.
*/
import React, {Component, PureComponent} from "react";
import "./style.css";
class Resizer extends PureComponent {
onDrag = (e) => {
let horizontal = this.props.orientation === "horizontal",
@Skitionek
Skitionek / d3+angularjs_directive_template.js
Last active June 19, 2017 09:57
Lovely template for embbeding d3 element to AngularJS
(function() {
'use strict';
/**
* @ngdoc directive_template
* @name app.controller:d3Directive
* @author Dominik Maszczyk
* @email Skitionek@gmail.com
* @description
* # d3Directive