Skip to content

Instantly share code, notes, and snippets.

View Dema's full-sized avatar

Dmitry Olyenyov Dema

View GitHub Profile
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Criterion.Main
import Criterion.Config
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.Char8 as C
import GHC.Word
bstring = B.unpack . C.pack
map_:: String -> [GHC.Word.Word8]
var Benchmark = require( 'benchmark')
var Immutable = require("immutable")
var suite = new Benchmark.Suite;
var json = {
"hello": [
{
@Dema
Dema / userChome.css
Last active December 9, 2019 11:03
userChome.css for Firefox Quantum. Multirow tabs
@namespace url('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul');
#TabsToolbar {
display: block !important;
}
:root {
--tab-min-height: 23px !important;
}
/* Selectors for Firefox 71+ */
@Dema
Dema / commands.js
Created October 21, 2019 20:08
Cypress recaptcha command
Cypress.Commands.add("clickRecaptcha", () => {
cy.window().then(win => {
win.document
.querySelector("iframe[src*='recaptcha']")
.contentDocument.getElementById("recaptcha-token")
.click();
});
});
@Dema
Dema / .eslintrc.js
Created November 13, 2019 08:38
My typescript eslintrc
module.exports = {
extends: [
"react-app",
"plugin:jsx-a11y/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:css-modules/recommended",
// "plugin:redux-saga/recommended",
"plugin:jest/recommended"
nix-instantiate --strict --json --eval -E 'builtins.map (p: p.name) (import <nixpkgs/nixos> {}).config.environment.systemPackages' | nix run nixpkgs.jq -c jq -r '.[]' | sort -u
{
"/nix/store/hynacjy0ps0qnz7bycsvnyiimv3q0i6h-netgen.drv": {
"outputs": {
"out": {
"path": "/nix/store/8qbgz0psv6zvfrn3kwgmjd8sb3b0jk90-netgen"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
import { ReactNode } from "react";
import { UnreachableCaseError } from "ts-essentials";
export type RemoteDataContents<T> = T extends RemoteData<infer Data, any>
? Data
: never;
export enum RemoteDataStatus {
Initialized = "Initialized",
Pending = "Pending",
@Dema
Dema / addLinara.js
Created November 19, 2020 20:45
Adds Linaria to create-react-app project that uses react-app-rewired and customize-cra
// need to add src/.linaria-cache to .gitignore. I had to move .linaria-cache inside src folder because CRA
// does not allow imports outside src folder.
// I've no idea what is this shit behind babelOptions but it works.
const addLinaria1x = () => (config) => {
addBabelPreset("linaria/babel")(config);
const babelLoader = getBabelLoader(config);
const { loader, options } = babelLoader;
const { plugins, presets } = options;
@Dema
Dema / PKGBUILD
Created July 13, 2021 06:40
xmonad session arch package
pkgname=xmonad-dema-xsession
pkgver=1.0
pkgrel=0
arch=("any")
package (){
mkdir -p "${pkgdir}/usr/share/xsessions"
cp ../xmonad.desktop "${pkgdir}/usr/share/xsessions"