Skip to content

Instantly share code, notes, and snippets.

View karladler's full-sized avatar

Karl Adler karladler

View GitHub Profile
{"zipCodes":
["01067","01069","01097","01099","01108","01109","01127","01129","01139","01156","01157","01159","01169","01187","01189","01217","01219","01237","01239","01257","01259","01277","01279","01307","01309","01324","01326","01328","01445","01454","01458","01465","01468","01471","01477","01558","01561","01587","01589","01591","01594","01609","01612","01616","01619","01623","01640","01662","01665","01683","01689","01705","01723","01728","01731","01734","01737","01738","01744","01762","01768","01773","01774","01776","01778","01796","01809","01814","01816","01819","01824","01825","01829","01833","01844","01847","01848","01855","01877","01896","01900","01904","01906","01909","01917","01920","01936","01945","01968","01979","01983","01987","01990","01993","01994","01996","01998","02625","02627","02633","02681","02689","02692","02694","02699","02708","02727","02730","02733","02736","02739","02742","02747","02748","02763","02779","02782","02785","02788","02791","02794","02796","02797","02799","02826","02827","0
@karladler
karladler / index.js
Created May 19, 2019 20:32
Dialogflow express.js backend for two intents. One fetches next event from barcamp app, the other reacts to opnions.
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
'use strict';
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Text, Suggestion} = require('dialogflow-fulfillment');
const cache = require('memory-cache');
const https = require('https');
const express = require('express');
@karladler
karladler / usefullsetup.md
Last active May 9, 2023 18:16
Use full OSX settings

Make autohidden dock appear fast:

defaults write com.apple.dock autohide-delay -float 0; killall Dock

Restore default delay for dock:

defaults delete com.apple.dock autohide-delay; killall Dock

Auto accept Outlook 365 autodiscover redirect

JSON => CSV => JSON converter for digital Twins

{
    "description": "Metadata for forklifts, seperated by categories.",
    "imgSquare": "",
    "name": "Forklift Metadata",
    "dataSchema": {
      "identity": {
 "$id": "identity_schema",
@karladler
karladler / UI-trouble-shooting.md
Last active January 8, 2020 09:29
evan.network Trouble shooting

Solve common UI problems on local development

node-sass build failed

Problem:

Error: Missing binding /Users/.../ui/ui-dapp-browser/node_modules/node-sass/vendor/darwin-x64-72/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x

Found bindings for the following environments:
@karladler
karladler / uploadResolver.ts
Created April 1, 2020 17:03
graphql upload
import {
Resolver, Mutation, Arg,
} from 'type-graphql';
import { GraphQLUpload } from 'apollo-server-koa';
import { Stream } from 'stream';
import { createWriteStream } from 'fs';
interface Upload {
filename: string;
mimetype: string;
@karladler
karladler / invariantErrorCodes.js
Created May 20, 2021 13:04
node_modules/@apollo/client/invariantErrorCodes.js
// This file is meant to help with looking up the source of errors like
// "Invariant Violation: 35" and is automatically generated by the file
// @apollo/client/config/processInvariants.ts for each @apollo/client
// release. The numbers may change from release to release, so please
// consult the @apollo/client/invariantErrorCodes.js file specific to
// your @apollo/client version. This file is not meant to be imported.
{
"@apollo/client version": "3.2.2",
1: {
@karladler
karladler / common.sql
Last active March 13, 2023 15:42
Public Postgres Snippets
/* Count unique entries in `column_name` */
SELECT column_name, count(*) FROM "table_name" GROUP BY column_name;
/* find entries with (NOT) numeric string */
SELECT * FROM table_name WHERE NOT column_name ~ '^\d+\.?\d+$';
/* trim in place */
UPDATE table_name SET column_name = TRIM (column_name);
/* to lower case in place */
@karladler
karladler / instructions.md
Last active November 30, 2021 15:25
Code Commit multi User SSH for GIT
@karladler
karladler / TypeScript Helpers.ts
Last active January 11, 2022 08:38
Typescript helpers for building interfaces
/**
* Make all properties partial and then pick only some that are required:
* https://stackoverflow.com/questions/52703321/make-some-properties-optional-in-a-typescript-type
*/
export type OptionalExceptFor<T, TRequired extends keyof T> = Partial<T> & Pick<T, TRequired>
/**
* Type XOR
*/
type Diff<T, U> = T extends U ? never : T;