After spending hours reading half baked or old medium articles explaining how to setup java in macOS, I made an updated version that covers what I think are the best tricks.
# remove any versions. autocomplete should help
#!/bin/bash | |
# Install the dependencies: | |
# | |
# brew install pipx | |
# pipx install graphql-schema-diff | |
# | |
# Example usage: | |
# λ › ./schemacheck.sh src/schema/schema.graphqls |
#!/usr/bin/env python3 | |
import argparse | |
import os | |
class Config: | |
local: str | |
dev: str | |
tst: str | |
wus: str |
import toolz.dicttoolz as dz | |
class Dictz(dict): | |
"""Wrapper class of dict injected with dicttoolz | |
## Rational ## | |
Using several dicttoolz funcs in a row can be cumbersome | |
For Example: |
After spending hours reading half baked or old medium articles explaining how to setup java in macOS, I made an updated version that covers what I think are the best tricks.
# remove any versions. autocomplete should help
// Heavly based on this post. All credits to the author. | |
// https://www.bezkoder.com/kotlin-convert-object-data-class-to-another/ | |
// build.gradle.kt | |
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.0") | |
// file.kt | |
import kotlin.reflect.full.memberProperties | |
data class Customer( |
def strip_var_envs(prefix): | |
""" | |
Matches all environment variables with a certain prefix. | |
Returns a dict with the key of the variable without the prefix. | |
Example: | |
env vars: | |
- CI_API_KEY=key | |
- CI_URL=https://httpbin.org | |
- BASE_URL=https://example.com |
function restore_db_heroku() { | |
: ${1?"Usage: $1 Heroku app; $2 Local DB"} | |
echo "Capturing a new backup and downloading..." | |
echo "" | |
heroku pg:backups:capture -a $1 | |
heroku pg:backups:download -a $1 | |
mv latest.dump "${1}_latest.dump" | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U sherby -d $2 "${1}_latest.dump" | |
echo "" |
def get_all_fields(obj): | |
""" | |
return a {field:value} dict for a Django Model object | |
lambda equivelent. useful for pasting in idle | |
list_fields = lambda obj: {f.name: getattr(obj, f.name) for f in obj._meta.fields} | |
""" | |
return {f.name: getattr(obj, f.name) for f in obj._meta.fields} | |