Skip to content

Instantly share code, notes, and snippets.

View niieani's full-sized avatar

Bazyli Brzóska niieani

View GitHub Profile
@niieani
niieani / example.sh
Created March 8, 2018 18:19
Bash Module System
#!/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
@niieani
niieani / flowtype-vs-typescript.md
Last active November 27, 2018 09:10
Differences between Flowtype and TypeScript
@niieani
niieani / app.html
Last active September 4, 2018 09:37
Aurelia: Suboptimal repeat element lifecycle [alternative without compose + optimized-repeat]
<template>
<require from="./component"></require>
<input type="checkbox" ref="isFiltering">
<br>
<component
optimized-repeat.for="id of components | without8: isFiltering.checked"
text.bind="id">
[${$index}]
</component>
@niieani
niieani / has-property.ts
Created April 21, 2018 06:08
TypeScript hacks
type HasProperty<X, P> = (X[keyof X & P] extends P ? true : false) extends false ? true : false
type example = HasProperty<{type:1}, 'type'>
@niieani
niieani / jestAsyncSuite.js
Created March 4, 2018 18:51
jest async suite
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 January 24, 2018 21:37
WrappedImportDependencyTemplate - wrap the closest asynchronous import() and add logic to it
// @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 / app.html
Last active January 4, 2018 02:38
Aurelia Observer Test + AST hooks
<template>
<require from="./example"></require>
<binding-intercept-example if.bind="show"></binding-intercept-example>
</template>
@niieani
niieani / app.html
Last active November 22, 2017 19:43
Aurelia Observer Test + evaluate + connectable-binding change + fix
<template>
<require from="./example"></require>
<binding-intercept-example if.bind="show"></binding-intercept-example>
</template>
@niieani
niieani / MoveChunkExecutionWebpackPlugin.js
Last active August 28, 2017 13:22
MoveChunkExecutionWebpackPlugin
/* 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.
*/