Skip to content

Instantly share code, notes, and snippets.

View deltaepsilon's full-sized avatar
🤡
Moving to private repos!!!

Chris Esplin deltaepsilon

🤡
Moving to private repos!!!
View GitHub Profile
@deltaepsilon
deltaepsilon / dates
Created July 2, 2023 23:26
Pull EXIF Create Date using exiftool and prefix the filename with YYYYMMDD_HHMMSS_*
#!/bin/bash
## Installation: Add to path and call with `dates` or `dates <directory>`
## Bard prompt: "write me a script to use exiftool to prefix mp4 filenames with their timestamps"
if [[ $1 ]]; then
echo "The first argument exists"
current_directory=$(pwd)/$1
else
Get-ChildItem "C:\Users\chris\Downloads" -Filter *.zip |
Foreach-Object {
$name = $_.Name
$folderName = $name.Split('.')[0]
$folderPath = "C:\Users\chris\Downloads\takeout-in\$folderName\"
echo "Processing $folderPath"
New-Item $folderPath -type Directory
@deltaepsilon
deltaepsilon / CODE_GUIDELINES.md
Last active April 28, 2023 18:19
WIP Code Guidelines for React

Code Guidelines for React

Hat tip to Clean Code by Robert C. Martin (Uncle Bob)

Goals

  • Consistency
  • Predictability
  • Maintainability
  • Readability
Run chromaui/action@v1
Chromatic CLI v5.7.0
https://www.chromatic.com/docs/cli

Firebase CI/CD with Google Cloud Build

[[Fireline]]: Firebase Functions + Stripe FTW

Fireline is a recent open source project of mine.

It's a series of drop-in Firebase Functions and React hooks that integrate with Stripe to add SaaS payments to web apps.

steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull us.gcr.io/$PROJECT_ID/flyerr:latest-$BRANCH_NAME || exit 0']
- name: 'gcr.io/cloud-builders/docker'
args:
[
'build',
'-t',
'us.gcr.io/$PROJECT_ID/flyerr:latest-$BRANCH_NAME',
const flatten = require('./flatten');
describe('flatten', () => {
it('should flatten deeply nested arrays of integers', () => {
const arrays = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12]]]
const expected = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
expect(flatten(arrays)).toEqual(expected);
});
});
@deltaepsilon
deltaepsilon / authorization-on-create.js
Last active July 23, 2018 12:57
Cloud Function to manage Custom Claims
const getCustomClaimsByEmail = require('../utilities/get-custom-claims-by-email');
const setCustomClaims = require('../utilities/set-custom-claims');
module.exports = ({ admin, environment }) => user => {
const db = admin.firestore();
const usersCollection = db.collection(environment.schema.users);
const customClaimsRef = admin.database().ref(environment.schema.customClaims);
const auth = admin.auth();
const email = extractEmailFromUser(user);

Keybase proof

I hereby claim:

  • I am deltaepsilon on github.
  • I am chrisesplin (https://keybase.io/chrisesplin) on keybase.
  • I have a public key ASDNf4HlYGnWXIBBydCSgZa1Wk1q2Z7eUr0Xa5x62ffqbQo

To claim this, I am signing this object:

@deltaepsilon
deltaepsilon / firebase.mixin.js
Created July 28, 2017 10:38
A Polymer 2.0 mixin to watch a bunch of Firebase refs. Returns an observable.
if (typeof window.FirebaseMixin == 'undefined') {
window.FirebaseMixin = superclass => {
if (!superclass) {
superclass = class Superclass {};
}
return class extends superclass {
constructor() {
super();
this.__firebaseMixinInit();