Skip to content

Instantly share code, notes, and snippets.

View tribou's full-sized avatar

Aaron Tribou tribou

View GitHub Profile
const { withDangerousMod, withPlugins } = require("@expo/config-plugins");
const {
mergeContents,
} = require("@expo/config-plugins/build/utils/generateCode");
const fs = require("fs");
const path = require("path");
async function readFileAsync(path) {
return fs.promises.readFile(path, "utf8");
}
@nicksantamaria
nicksantamaria / config.yml
Created July 9, 2020 01:26
Terraform CircleCI Workflow
version: 2
jobs:
plan:
docker:
- image: hashicorp/terraform:latest
working_directory: /code
steps:
- checkout
- run:
name: Init
@CJBridges
CJBridges / circleci_command_for_cache_optimization.yml
Last active January 22, 2024 18:56
CircleCI does not support checks for existence of a cache key without restoring the full cache. Save a tiny key in parallel with the cache to allow bailing out faster if the cache already exists. More documentation on the approach and the code I started from (thanks TzookB!) is here: https://tzookb.com/circleci-project-deepdive
commands:
halt_if_cache_exists:
description: Halt a build if a cache already exists, without downloading the entire cache. Match only exact key. Pair with mark_cache_existence.
parameters:
category:
description: friendly name of the sort of cache (e.g. bundle, src)
type: string
key:
description: hash key where underlying data would be stored
@laughinghan
laughinghan / Every possible TypeScript type.md
Last active March 31, 2024 04:40
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@tribou
tribou / nvm_auto_switching.sh
Last active January 9, 2020 02:40
Use PROMPT_COMMAND and nvm to auto-switch versions of node
#!/bin/bash
# Activate a version of Node that is read from a text file via NVM
function use_node_version()
{
local TEXT_FILE_NAME="$1"
local CURRENT_VERSION=$([ -n "$HAS_NVM" ] && nvm current)
local PROJECT_VERSION=$([ -n "$HAS_NVM" ] && nvm version $(cat "$TEXT_FILE_NAME"))
# If the project file version is different than the current version
@Vovan-VE
Vovan-VE / example.action-types.ts
Last active July 19, 2021 14:31
TypeScript: redux-thunk & redux-promise-middleware together
import { Action } from 'redux';
import { AsyncAction, AsyncFulfilledAction } from './redux-thunk-promise';
import { ApiResult } from 'api/...';
export const FETCH = '.../FETCH';
export const FETCH_PENDING = '.../FETCH_PENDING';
export const FETCH_FULFILLED = '.../FETCH_FULFILLED';
export const FETCH_REJECTED = '.../FETCH_REJECTED';
export type FetchAction = AsyncAction<typeof FETCH, ApiResult>;
@oseme-techguy
oseme-techguy / Correct_GnuPG_Permission.sh
Last active April 28, 2024 04:37
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@tribou
tribou / init.coffee
Created September 17, 2017 22:02
Customize Atom tab titles to display folder and file name
# Add folder and filename to tab title
atom.workspace.observeTextEditors (editor) ->
if editor.getTitle() isnt "untitled"
sp = editor.getPath().split('/')
title = sp.slice(sp.length-2).join('/')
editor.getTitle = -> title
editor.getLongTitle = -> title
editor.emitter.emit "did-change-title", editor.getTitle()
atom.workspace.onDidOpen (event) ->
@tribou
tribou / sizes.sh
Created February 21, 2016 15:33
List file and folder sizes in current directory with bash
#!/bin/bash
# Example usage: sizes path/to/somewhere/
sizes ()
{
ls -lrt -d -1 ${PWD}/${1}* | xargs du -sh
}