Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Workin' on Gadget at https://gadget.dev

Harry Brundage airhorns

🎯
Workin' on Gadget at https://gadget.dev
View GitHub Profile
View example.gelly
query issues {
id
name
filter timeLogs by timeSpent > 10 {
timeSpent
level
} then group by level {
sum(timeSpent)
} then filter by deletedAt is not set and publishedAt < NOW()
then sort by timeSpent Descending
View webpack error
#21 0.382 yarn run v1.22.5
#21 0.410 $ rm -rf packages/web/dist/* && NODE_ENV=production yarn workspace web webpack
#21 0.862 $ /app/node_modules/.bin/webpack
#21 1.823 (node:52) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
#21 1.823 (Use `node --trace-deprecation ...` to show where the warning was created)
#21 36.85 internal/fs/utils.js:628
#21 36.85 throw err;
#21 36.85 ^
#21 36.85
#21 36.85 TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received '/app/node_modules/es5-ext/string/\x00#/contains'
@airhorns
airhorns / yarn.lock
Created Jul 21, 2020
snowpack webpack debugging
View yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.8.3":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==
dependencies:
"@babel/highlight" "^7.10.4"
View Suspender.ts
/** Wrapper class that creates an introspectable promise that can be used to suspend */
export class Suspender<T> {
debug = false;
promise: Promise<T>;
finished = false;
rejected = false;
resolution: T | null = null;
rejectReason: any = null;
id = id++;
View SubscriptionClient.ts
declare let window: any;
const _global = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {};
const NativeWebSocket = _global.WebSocket || _global.MozWebSocket;
import Backoff from "backo2";
import { default as EventEmitterType, EventEmitter, ListenerFn } from "eventemitter3";
import { ExecutionResult } from "graphql/execution/execute";
import { DocumentNode } from "graphql/language/ast";
import { print } from "graphql/language/printer";
import { getOperationAST } from "graphql/utilities/getOperationAST";
@airhorns
airhorns / PromiseModel.ts
Last active Jul 5, 2020
mobx-state-tree Promise model
View PromiseModel.ts
import { cast, flow, IAnyType, Instance, SnapshotOrInstance, types } from "mobx-state-tree";
import { assert } from "../lib/utils";
let counter = 0;
const RejectReasontype = types.maybe(types.frozen<Error>());
/**
* `mobx-state-tree` promise model factory that is observable and plays nice with the atomic middleware. Useful for embedding in the tree to fetch data on demand and reporting it's availability. It's kind of like an Apollo graphql query, but purely just state, more general, and observable.
* __Note__: This is different than normal `Promise`s because this is a factory: it produces one class of promise (a mst model) where instances of the model get configured with arguments to then execute that specific instancce
*/
@airhorns
airhorns / browserless-lighthouse.ts
Created Jan 8, 2020
Browserless-token authentication for lighthouse
View browserless-lighthouse.ts
import https from 'https';
import WebSocket from 'ws';
import log from 'lighthouse-logger';
import queryString from 'query-string';
import LighthouseError from 'lighthouse/lighthouse-core/lib/lh-error';
import ChromeProtocol from 'lighthouse/lighthouse-core/gather/connections/cri';
const CONNECT_TIMEOUT = 10000;
log.setLevel('info');
@airhorns
airhorns / gunicorn_structlog_setup.py
Created Sep 13, 2019
Gunicorn structlog integration
View gunicorn_structlog_setup.py
import os
import logging.config
import structlog
from .app import app
timestamper = structlog.processors.TimeStamper(fmt="iso")
pre_chain = [
# Add the log level and a timestamp to the event_dict if the log entry is not from structlog.
structlog.stdlib.add_log_level,
View loadImageBlob.ts
export const dataURIMime = (uri: string) => {
return uri.split("")[0].slice(5);
};
export const dataUriToBlob = (uri: string) => {
const data = uri.split(",")[1];
const bytes = atob(data);
const buffer = new ArrayBuffer(bytes.length);
let array = new Uint8Array(buffer);
@airhorns
airhorns / Gemfile.lock
Created Feb 25, 2019
Fellow shipit gemfile
View Gemfile.lock
GIT
remote: https://github.com/airhorns/shipit-engine.git
revision: 2ecd45860f989828041eeb317947f71d8c40c68d
ref: tail-task-fix
specs:
shipit-engine (0.27.0)
active_model_serializers (~> 0.9.3)
ansi_stream (~> 0.0.6)
attr_encrypted (~> 3.1.0)
autoprefixer-rails (~> 6.4.1)