Skip to content

Instantly share code, notes, and snippets.

View zbigg's full-sized avatar
🧗

Zbigniew Zagórski zbigg

🧗
View GitHub Profile
@zbigg
zbigg / gist:4211ad3e5c4d6a37f81e
Created June 23, 2015 07:05
DEBUG_ENVIRONMENT_SETTING
void debugMaybeSetVariable( const char*& ref, const char* variable_name )
{
const char* env_variable = std::getenv( variable_name );
if( !env_variable )
{
return;
}
std::cerr << "using value" << variable_name << "=" << env_variable << "\n";
ref = env_variable;
}
@zbigg
zbigg / test-sequelize-bug-5092-paranoid.js
Created March 28, 2017 06:43
test-sequelize-bug-5092-paranoid.js
const Sequelize = require('sequelize');
const config = require(__dirname + '/config/sequelize.json')[process.env.NODE_ENV || 'development'];
const sequelize_options = {
logging: console.log,
define: {
timestamps: true,
// paranoid: true,
underscored: true,
freezeTableName: true,
//
// this automagically parses all JSX files
// from client
//
process.env.BABEL_DISABLE_CACHE = 1;
require('babel-register')({
presets: ['react', 'es2015'],
only: [ "web/src" ]
});
FROM gradle:4.10.1-jdk8
USER root
# Install Build Essentials
RUN \
apt-get update && \
apt-get install -y \
build-essential \
file \
@zbigg
zbigg / typescript-robust-options-and-params-interfaces.md
Last active October 25, 2023 12:26
Options/Params/Defaults pattern

Options/Params/Defaults pattern

Code

// public part
export interface MyApiOptions {
    /// Typedoc here
    foo?: string;
dist/gh_deploy/
dist/gh_deploy/decoder.bundle.js.map
dist/gh_deploy/releases.json
dist/gh_deploy/_config.yml
dist/gh_deploy/index.css.map
dist/gh_deploy/0ce79b6b2ddf393b809c7a2ae509941e.jpg
dist/gh_deploy/index.bundle.js.map
dist/gh_deploy/docs
dist/gh_deploy/docs/index.html
dist/gh_deploy/examples
@zbigg
zbigg / test.md
Created February 21, 2020 11:28
Test

FooBar

type JsonAllTypes = null | string | number | boolean | object;
/// Tainted Input - type modifier, that decorates "proper" type with
/// all possible bad input types.
/// Purpose. When parsing input, it's common to write
///
/// const x: Type = JSON.parse(input);
///
@zbigg
zbigg / objectKeyWithBestScore.ts
Created February 13, 2023 10:53
objectKeyWithBestScore.ts
/**
* Given dictionary K -> V, find a key with best score.
*
* If no score fun returns defined value, it will return `undefined`.
*
* Complexity O(nKeys)
*
* @param object object to search
* @param scoreFun score function applied over (k,v)
* @returns key or undefined
@zbigg
zbigg / CoreFlowWithUserInteraction.md
Created February 13, 2023 12:18
CoreFlowWithUserInteraction.md

‎‎​