Skip to content

Instantly share code, notes, and snippets.

Bazyli Brzóska niieani

Block or report user

Report or block niieani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@niieani
niieani / google-photos.user.css
Created Jul 9, 2019
Remove top gradient in Google Photos
View google-photos.user.css
/* ==UserStyle==
@name Remove top gradient in Google Photos - 09/07/2019, 22:08:26
@namespace github.com/niieani
@version 1.0.0
@description Removes the annoying top gradient in the Google Photos views: full screen photo, album
@author Bazyli Brzóska
==/UserStyle== */
@-moz-document domain("photos.google.com") {
.KYCEmd {
background-image: none;
View has-property.ts
type HasProperty<X, P> = (X[keyof X & P] extends P ? true : false) extends false ? true : false
type example = HasProperty<{type:1}, 'type'>
@niieani
niieani / example.sh
Created Mar 8, 2018
Bash Module System
View example.sh
#!/usr/bin/env bash
SCRIPT_DIR=${BASH_SOURCE[0]%/*}
# load our module system:
source "${SCRIPT_DIR}/module.sh"
# below command imports module ./greeter.sh and run its 'greet' function with the following arguments:
module greeter greet tterranigma
module greeter greet niieani
View jestAsyncSuite.js
const { default: reporter } = require.requireActual(
"jest-jasmine2/build/reporter"
);
function runSuite(suite, parentSuite) {
const topSuite = jasmine.getEnv().topSuite();
const { children, id, result } = topSuite;
// setting this suite to disabled will not cause jest to
// clearResourcesForRunnable for this suite's ID
suite.disabled = true;
@niieani
niieani / WrappedImportDependencyTemplate.js
Created Jan 24, 2018
WrappedImportDependencyTemplate - wrap the closest asynchronous import() and add logic to it
View WrappedImportDependencyTemplate.js
// @flow
// let's ensure we require the right instance of webpack (when package is linked):
const require = module.parent && module.parent.parent && module.parent.parent.require
? module.parent.parent.require.bind(module.parent.parent)
: module.require
export type DebuggerType = (context : string, meta : Object) => void
const ImportDependency = require('webpack/lib/dependencies/ImportDependency')
@niieani
niieani / utils.ts
Created Nov 26, 2017
TypeScript utils
View utils.ts
// many based/copied from https://github.com/tycho01/typical/tree/master/src
// utility types:
type False = "0";
type True = "1";
type Bool = True | False;
type If<Cond extends Bool, Then, Else> = { 1: Then; 0: Else }[Cond];
type WrapInPromiseIfTrue<T, IsAsync extends Bool> = If<
IsAsync,
Promise<T>,
@niieani
niieani / MoveChunkExecutionWebpackPlugin.js
Last active Aug 28, 2017
MoveChunkExecutionWebpackPlugin
View MoveChunkExecutionWebpackPlugin.js
/* eslint-disable no-param-reassign */
/*
You should inline the chunk that this outputs into your HTML
then execute window.onReady() when all chunks are loaded, e.g.
<script async onload="executeWhenAllChunksLoaded()" src="...">
where 'executeWhenAllChunksLoaded' runs 'onReady()' once all chunks have loaded
You may use HtmlWebpackPlugin in combination with ScriptExtHtmlWebpackPlugin to do the inlining.
*/
@niieani
niieani / index.js
Last active Aug 1, 2017
Benchmarking FizzBuzz implementations
View index.js
const fizzers = {
'dummy': (n) => {throw new Error('reject first test')},
'concat result': (n) => (n % 3 ? '' : 'fizz') + (n % 5 ? '' : 'buzz') || n,
'concat result strict': (n) => (n % 3 === 0 ? '' : 'fizz') + (n % 5 === 0 ? '' : 'buzz') || n,
'nested ternary': (n) => n % 3
? (n % 5 ? n : "Buzz")
: (n % 5 ? "Fizz" : "FizzBuzz"),
'template string': (n) => `${n % 3 ? '' : 'fizz'}${n % 5 ? '' : 'buzz'}` || n,
'concat all': (n) => (n % 3 ? '' : 'fizz') + (n % 5 ? '' : 'buzz') + n,
'append string': (n) => {
View babel-interop.js
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
You can’t perform that action at this time.