Skip to content

Instantly share code, notes, and snippets.

View a-ignatov-parc's full-sized avatar

Anton Ignatov a-ignatov-parc

View GitHub Profile
{
"@context": {
"@version": 1.1,
"Passport": {
"@context": {
"@protected": true,
"@version": 1.1,
"@vocab": "https://big-plato.com/vocab#Passport",
"Surname": {
{
"@version": 1.1,
"@protected": true,
"@id": "https://big-plato.com/vocab/CustomVc",
"@context": {
"@protected": true,
"@vocab": "https://big-plato.com/vocab/CustomVc#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"foo": { "@type": "xsd:string" },
@a-ignatov-parc
a-ignatov-parc / eslint_run.sh
Last active July 24, 2020 12:32
VSCode bazel autobuild
#!/bin/bash
{bash_runfiles}
runfiles_export_envvars
$(rlocation {cli}) --config $(rlocation {config}) {targets} | sed 's/^.*\.runfiles\/[^/]*\///g'
@a-ignatov-parc
a-ignatov-parc / bind.js
Last active October 12, 2017 12:21
Idempotent `Function.bind()`. Helpful when using with react.js to bind arguments to event handler
const dictionary = new WeakMap();
const fallbacks = new Map();
const VALUE = '_value';
function resolveLeaf(target, path) {
const tail = path.reduce((branch, item) => {
if (!branch.has(item)) branch.set(item, new Map());
return branch.get(item);
}, target);
# Every render (without JssProvider)
"default" 0 0
"secondary" 0 1
"native" 0 2
"default" 0 3
"secondary" 0 4
"native" 0 5
".default-0-0:hover" 0 6
".default-0-0:active" 0 7
".default-0-0:visited" 0 8
@a-ignatov-parc
a-ignatov-parc / module-transformer.js
Last active June 29, 2017 07:26
Jest integration with webpack
// jest/module-transformer.js
'use strict';
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const { execSync } = require('child_process');
const hashFiles = require('hash-files');
const pageInfo = Array
.from(document.querySelectorAll('*'))
.map(element => {
const computedStyles = window.getComputedStyle(element);
const styles = ['color', 'background-color'].reduce((result, name) => {
result[name] = computedStyles.getPropertyValue(name);
return result;
}, {});
const defaults = {
filename: 'versions.json',
};
class HashDictionaryPlugin {
constructor(options) {
this.options = Object.assign({}, defaults, options);
}
apply(compiler) {
import fs from 'fs';
import stream from 'stream';
import gulp from 'gulp';
import {File} from 'gulp-util';
import rename from 'gulp-rename';
import through from 'through2';
import buffer from 'vinyl-buffer';
const stateStream = new Bacon.Bus();
const appState = stateStream
.filter(Boolean)
.scan({}, (a, b) => Object.assign({}, a, b));
const incomingData = Bacon.fromBinder(createBinderToSockets(sockets));
const topArrow = Bacon
.fromEvent(document.queryElement('#top'), 'click')