Skip to content

Instantly share code, notes, and snippets.

@gerardmrk
gerardmrk / main.tf
Created September 24, 2019 02:57
0.12 foot gun
# DICTIONARIES/REFERENCES
locals {
_SEP = {
lower = ""
upper = ""
snake = "_"
spinal = "-"
camel = ""
pascal = ""
}
@gerardmrk
gerardmrk / settings.json
Last active August 23, 2019 01:54
Go Conf VSCode FFS
{
"go.useLanguageServer": true,
"go.languageServerFlags": [
"-rpc.trace",
"serve",
"--debug=localhost:6060",
],
"go.alternateTools": {
"go-langserver": "gopls"
},
#!/bin/bash
#
# This script ...
# This script has been tested with the following OSs:
# - Ubuntu 16.04
# - Ubuntu 18.04
#
set -e
@gerardmrk
gerardmrk / actions.ts
Created May 19, 2019 03:45
Refined create reducer, strongly typed
import { createAction } from "typesafe-actions";
import { MessageLevel, DEFAULT_TTL } from ".";
export type ShowPayload = {
level?: MessageLevel;
header?: TKey;
content?: TKey;
list?: TKey[];
autoDismiss?: false | number;
};
# check out the regexp HAHA
#
# the formula takes the current timestamp and parses it into a valid,
# non-repeating (run-once; subsequent runs is scheduled by the process itself)
# AWS CloudWatch Event schedule-expression rule. This is for a very specific
# use-case; the event rule is set to trigger a self-updating ECS cron job
# 10 minutes from the time provisioning completes successfully, assumming
# provisioning takes less than 10 minutes.
#
# see:
@gerardmrk
gerardmrk / _main.tf
Last active December 4, 2018 01:23
produce valid jsons in Terraform. HCL syntax
locals {
object_map = {
id = 12
name = "arkansas"
pending = "true"
amount = 112.25
outstanding = ""
send_receipt = false
}
declare module "unchanged" {
type PathSelector = string[] | number[] | number | string;
export interface GetFn {
<T>(path: PathSelector, target: T): T;
}
export interface GetOrFn {
<T, F = any>(fallback: F, path: PathSelector, target: T): T;
}
@gerardmrk
gerardmrk / centeredPopup.js
Last active August 8, 2018 22:05
es6++ code snippet for centered popup (useful for OAuth1a/2.0 auth link popups)
// credits and references:
// - http://xtf.dk
// - https://developer.mozilla.org/en-US/docs/Web/API/Window/open
const createCenteredPopup = popupWindowRef => (url, title, options) => {
try {
if (!!popupWindowRef && !popupWindowRef.closed) {
return (
popupWindowRef.focus(),
import * as React from 'react'
import { Redirect, RouteComponentProps } from 'react-router-dom'
export interface Props extends RouteComponentProps<{}> {}
export interface State {
readonly nextPage: boolean
}
class Welcome extends React.PureComponent<Props, State> {
@gerardmrk
gerardmrk / index.tsx
Created November 9, 2017 00:43
Centralized React router configuration
/**
* Centralized routes config
*/
import * as React from "react";
import { RouteProps as ReactRouteProps } from "react-router-dom";
import { isDev, isHMR } from "@app/utils/flags";
// dynamically import the route module