Skip to content

Instantly share code, notes, and snippets.

View Cretezy's full-sized avatar

Cretezy

View GitHub Profile
import 'package:flutter_super_state/flutter_super_state.dart';
final store = Store();
// Register modules. Order does not matter. You should register all modules on initialization
CounterModule(store);
import 'package:flutter_super_state/flutter_super_state.dart';
// Modules extend `StoreModule`
class CounterModule extends StoreModule {
// Read only property, to avoid accidentally setting `counter` without calling `setState`
int get counter => _counter;
var _counter = 0;
// This automatically registers your module to your store
CounterModule(Store store): super(store);
@Cretezy
Cretezy / .dockerignore
Last active October 18, 2019 21:44
Node + Docker with proper caching
Dockerfile
node_modules
@Cretezy
Cretezy / keybase.md
Created July 27, 2018 04:49
Keybase

Keybase proof

I hereby claim:

  • I am cretezy on github.
  • I am cretezy (https://keybase.io/cretezy) on keybase.
  • I have a public key ASDCcHC4gAtfkgUsunkH6TV5kFoCD41eVYW6JtkKzmjq1Qo

To claim this, I am signing this object:

@Cretezy
Cretezy / signing.js
Last active February 21, 2019 06:14
Node signing helper
import crypto from "crypto";
const separator = ":";
export function sign(content, secret) {
const signature = generateSignature(content, secret);
return {
signature,
content,
signedContent: join(content, signature)
@Cretezy
Cretezy / FirestoreBatcher.js
Last active June 3, 2018 05:36
Helper for batching operations in Firestore
export class FirestoreBatcher {
batches = [];
index = 0;
constructor(firestore) {
this.firestore = firestore;
}
getNext() {
if (this.index++ % 500 === 0) {
@Cretezy
Cretezy / Tools.md
Created May 30, 2018 15:24
Tools I use

Better react-hotkeys HOC

Usage:

withHotKeys({ new: "alt+n" }, { new: props => event => console.log(props, event) })(...)

Useful to use with recompose.

Keybase proof

I hereby claim:

  • I am cretezy on github.
  • I am cretezy (https://keybase.io/cretezy) on keybase.
  • I have a public key ASAyf6-mYb28_SnKYGRlnTBdDFIMpI4hgGlFXV21WC93Rgo

To claim this, I am signing this object:

@Cretezy
Cretezy / systemd-user-fix.md
Created May 21, 2017 18:38
systemd user "Failed to connect to bus: No such file or directory"

Simply add this snippet...

export XDG_RUNTIME_DIR="/run/user/$UID"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"

...to .bashrc or .zshrc or any file ran on login.