Skip to content

Instantly share code, notes, and snippets.

View hdngr's full-sized avatar

Huston Hedinger hdngr

View GitHub Profile
@miZyind
miZyind / get-valuable.ts
Last active April 12, 2024 14:56
A helper function to remove blank attributes from an object in TypeScript with type-safe
type Valuable<T> = { [K in keyof T as T[K] extends null | undefined ? never : K]: T[K] };
function getValuable<
// eslint-disable-next-line @typescript-eslint/ban-types
T extends {},
V = Valuable<T>,
>(obj: T): V {
return Object.fromEntries(
Object.entries(obj).filter(
([, v]) =>
@scaryguy
scaryguy / change_primary_key.md
Last active April 8, 2024 14:23
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
@rvanbruggen
rvanbruggen / linkedin-query.py
Last active March 28, 2024 19:53 — forked from ThomasCabrol/linkedin-2-query.py
Python script to query your LinkedIn network and get all your network's connections and their interconnections.
#!/usr/bin/env python
# encoding: utf-8
"""
linkedin-query.py
Created by Thomas Cabrol on 2012-12-03.
Customised by Rik Van Bruggen
Copyright (c) 2012 dataiku. All rights reserved.
Building the LinkedIn Graph
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",