Skip to content

Instantly share code, notes, and snippets.

View a88zach's full-sized avatar

Zach Tindall a88zach

View GitHub Profile
import { decode, verify, JwtPayload } from 'jsonwebtoken';
import fetch from 'node-fetch';
const publicUrl =
'https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com';
// cache public keys unitl expiration
const publicKeys = new Map<string, string>();
let expiresAt: number;
const getPublicKey = async (kid: string): Promise<string | undefined> => {
select table_schema,
table_name,
column_name,
data_type,
character_maximum_length,
(xpath('/row/max/text()',query_to_xml(format('select max(length(%I)) from %I.%I', column_name, table_schema, table_name), true, true, '')))[1]::text::int as max_length
from information_schema.columns
where table_schema = 'ccxp'
and data_type = 'character varying'
order by table_schema, table_name, column_name;
#!/bin/bash
# modified from https://gist.github.com/bartoszmajsak/1396344
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master main develop test release)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_TYPE=$(printf "${BRANCH_NAME%/*}")

Keybase proof

I hereby claim:

  • I am a88zach on github.
  • I am a88zach (https://keybase.io/a88zach) on keybase.
  • I have a public key ASBZGS9MLjulDMbMvE-JjMAO1KAJcU5fTJEHNWf2TMpgEgo

To claim this, I am signing this object:

@a88zach
a88zach / extractMap.ts
Created February 27, 2018 19:03
Extending rxjs
import { Observable } from 'rxjs/Observable';
function extractMap<T>(this: Observable<T>): Observable<T> {
return this.map(json => {
const data = <any>json;
return data.success ? data.result : Observable.throw('Response contained an unsuccessful status');
});
}
Observable.prototype.extractMap = extractMap;