Skip to content

Instantly share code, notes, and snippets.

View paolobueno's full-sized avatar

Paolo Bueno paolobueno

View GitHub Profile
@paolobueno
paolobueno / .gitignore
Last active February 6, 2020 16:26
TS new features showcase
/node_modules
/dist
/*-error.log
/.cache
/.yarn.lock
@paolobueno
paolobueno / keybase.md
Created August 7, 2019 16:21
keybase.md

Keybase proof

I hereby claim:

  • I am paolobueno on github.
  • I am paolobueno (https://keybase.io/paolobueno) on keybase.
  • I have a public key ASDUy0w1QCOfd1lT1rq874nVReK6h1z6rifwlc-3A3fP8Ao

To claim this, I am signing this object:

@paolobueno
paolobueno / speed-setup.md
Last active August 6, 2019 15:23
Ideas for speeding up
  • Make f1 - f12 default to function keys and require Fn for media keys
  • Optional: Remove mouse and reduce sensitivity of trackpad to force into keyboard use
  • Conventional app shortcuts:
    • f2: Rename
    • f8 - f11: Debug play/pause, step into, step out, step over, run to cursor (varies)
    • f12/Ctrl+Shift+I/J: Browser dev tools
    • Ctrl+Shift+C/I: Browser dev tools: inspect element
    • Ctrl+`: Invoke console
    • (Shift+)f5: Refresh
@paolobueno
paolobueno / arrays.js
Last active December 28, 2018 21:32
array scratchpad
const a = [1, 2];
a;
const mult = (x => (y => x * y));
const mult2 = mult(2);
// function mult2 (x) {
// return x * 2;
// }
@paolobueno
paolobueno / familia.html
Last active December 20, 2018 13:26
familia
<div id="pai">
<div id="vc">
<div id="filho1" class="filho">
<div id="neto1" class="neto"></div>
</div>
<div id="filho2" class="filho"></div>
</div>
<div class="irmao"></div>
</div>
@paolobueno
paolobueno / compose.js
Last active September 25, 2018 12:31
Simple variadic compose
const apply = (x, fn) => fn(x);
const c = (...fns) => {
[first, ...rest] = fns.reverse();
return x => rest.reduce(apply, first(x));
}
const add = x => y => x + y;
c(add(1), add(4))(3);
@paolobueno
paolobueno / permissions.sh
Created March 15, 2018 17:23
apb permissions
oc login -u system:admin
oc adm policy add-cluster-role-to-user access-asb-role developer
oc adm policy add-cluster-role-to-user cluster-admin developer
@paolobueno
paolobueno / benchmarks.sql
Created March 14, 2018 12:40
app metrics benchmarks
/*
Tested with data generated by
autocannon -a 150000 -m POST -I -b '{"clientId":"[<id>]","data":{"app":{"appId":"com.example.someApp","sdkVersion":"2.4.6","appVersion":"256"},"device":{"platform":"android","platformVersion":"27"}}}' http://localhost:3000/metrics
Thus creating 150k records.
This uses generated clientIds and the rest of the data is constant, thus it doesn't match very well the expected cardinality,
I'd like to redo these tests with better random data.
For example we wouldn't have unique clientIds per record, and have some variance in device platform, and some less in app info, and also a much bigger spread in event_times.
@paolobueno
paolobueno / overloading.ts
Created February 20, 2018 16:36
Config overload
export interface IKeycloakConfig {}
export interface IMetricsConfig {}
export class Config {
private serviceConfig: any[] = [];
/**
* @param config - any type of configuration that will be send from server.
* It's not possible easy/worth to wrap that to types. Even native implementations do not do that.
@paolobueno
paolobueno / typingTest.ts
Created January 18, 2018 18:32
Strong strings
class ServiceModule {}
class SyncService extends ServiceModule {}
class KeycloakService extends ServiceModule {}
type ServiceModuleConstructor<T extends ServiceModule> = new() => T;
class ServiceModuleRegistry {
private serviceTypeMap: {
[key: string]: ServiceModuleConstructor<ServiceModule>