Skip to content

Instantly share code, notes, and snippets.

View micimize's full-sized avatar

Michael Joseph Rosenthal micimize

  • San Francisco, CA
View GitHub Profile
@micimize
micimize / resolveBoxStyle.js
Created August 26, 2018 02:38
monkey patch for react-native inspector problems
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule resolveBoxStyle
* @flow
*/
'use strict';
@micimize
micimize / structured_cloud_log_handler.py
Last active February 27, 2019 21:53
Patches for the python stackdriver handlers for adding custom fields
import logging
import typing as t
from google.cloud.logging.handlers.handlers import (
DEFAULT_LOGGER_NAME,
CloudLoggingHandler,
)
from google.cloud.logging.handlers.transports import background_thread
@micimize
micimize / react-native-issues.md
Last active March 24, 2019 20:26
My myriad problems experienced with react-native (I last worked with RN Sep 10th, 2018)

preface

This is a slightly cleaned-up version of the venting I did while pulling my hair out over react-native issues. The state of using react-native might be getting better with the community restructuring and core-rewrite. So take these dated notes with a grain of salt.

summary

After months of struggling to port libraries and develop applications using react-native, I have to recommend trading the comfort and breadth of the react and javascript ecosystems for Flutter and dart if you're developing a mobile app.

react-native is buggy and slow (or at least very hard to make fast). Perhaps it can be blamed on the size of the community, but the project is managed in an almost adversarial style. Almost all issues are ignored until the bot closes them for being "stale". They get locked too, just to make sure the community can't communicate work

@micimize
micimize / _client.dart
Last active March 26, 2019 18:02
transient state management prototypes for graphql-flutter
import 'package:graphql_flutter/graphql_flutter.dart';
import '../serializers/scalars.dart' show uuidFromObject;
/// This prefix works differently than the normalization prefix
/// in that it is prepended to the id as '$prefix/$id'
final TRANSIENT_STATE_PREFIX = '@entity/transient_state';
final cache = OptimisticCache(
dataIdFromObject: uuidFromObject,
);
@micimize
micimize / cheap_clone.sh
Created May 19, 2019 21:22
helper to clone a repo for inspection (relatively) cheaply
function cheap_clone {
EXTERNAL_CLONE_DIR="~/code/external"
# mkdir -p $EXTERNAL_CLONE_DIR
GIT_HOST='github.com'
BRANCH='master'
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
@micimize
micimize / schema_constraints_checks.py
Last active July 6, 2019 16:10
efficient goodtables constraint checks
import typing as t
from goodtables import Error, check
from tableschema.exceptions import TableSchemaException
from .schema_field import ConstraintsError, ExtensibleField
# primaryKey and unique constraints are unaccounted for here
# TODO look into optimizing unique constraint checks
@micimize
micimize / df_partition.py
Created July 6, 2019 16:12
dataflow for partitioning a resource based on a validator
"""
In dataflows, the API for operating on an entire package goes as follows:
* we define a Higher order function to take in config and context
* in that function, we define and return a function that will operate on various resources.
In this instance, that function operates on the entire datapackage. To do so it yields, in order:
* the package definition, with changes (adds the new resource)
* a generator for each resource, in the order they are defined
"""
import typing as t
@micimize
micimize / goodtables_row_inspector.py
Created August 15, 2019 01:15
Row-wise inspection for goodtables
import typing as t
from math import inf
from goodtables import Inspector, cells
from goodtables.error import Error
from goodtables.inspector import _filter_checks
from goodtables.registry import registry
from tableschema import Schema
from .rules.full_schema_constraint import (
@micimize
micimize / xonshrc.py
Last active September 14, 2019 17:22
xonshrc in progress
$XONSH_SHOW_TRACEBACK = True
import typing as t
import xonsh.jobs
from time import strftime
from prompt_toolkit.key_binding import vi_state
from xonsh.prompt.vc import dirty_working_directory
xontrib load bashisms coreutils distributed docker_tabcomplete readable-traceback
@micimize
micimize / time_travel_trigger.sql
Last active October 3, 2019 22:37 — forked from myitcv/time_travel_trigger.sql
Trigger-based equivalent of old PostgreSQL time travel module - see http://blog.myitcv.org.uk/2014/02/25/row-level-version-control-with-postgresql.html for more details
/*
original contained the following, has since been modified
Copyright (c) 2015 Paul Jolly <paul@myitcv.org.uk)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell