Skip to content

Instantly share code, notes, and snippets.

View adamlaz's full-sized avatar

Adam Lazarus adamlaz

View GitHub Profile
@adamlaz
adamlaz / posthogOnGtmWithConsent.js
Created April 19, 2024 01:35
Use posthog via GTM in 'Consent Mode' with OneTrust & Elevar datalayer
'use strict';
(function() {
// Configuration constants
const POSTHOG_API_KEY = 'POSTHOG_API_KEY';
const POSTHOG_HOST = 'https://us.posthog.com';
// Checks if PostHog library is loaded, logs error if not
if (typeof posthog === 'undefined') {
console.error('PostHog library not loaded');
@adamlaz
adamlaz / dataform.js
Created November 14, 2023 03:37
Dataform Helpers
const getSqlEventParam = (
paramName,
paramType = "string",
columnName = false
) => getUnnestParam(paramName, paramType, columnName);
const getSqlUserProperty = (
paramName,
paramType = "string",
columnName = false
@adamlaz
adamlaz / ffmpeg-script.sh
Created January 4, 2023 14:15 — forked from lnikell/ffmpeg-script.sh
ffmpeg-web-optimized-vp9-h265
# Script accepts 5 parameters: input file, output folder, filename, -crf and number of pixels in width for scale options
# Validate that all parameters are passed
if [ $# -ne 5 ]; then
echo "Example usage: ffmpeg_crf.sh input.mp4 output-folder output-filename 3840 32"
exit 1
fi
# Validate that 5th parameter is a number within a range from 0 to 51
if [ $5 -lt 0 ] || [ $5 -gt 51 ]; then

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
# Install Google Cloud SDK and Components
printHeading "Install Google Cloud SDK and Components"
printStep "Google Cloud SDK" "brew install --cask google-cloud-sdk"
printDivider
echo "✔ Prepping Autocompletes and Paths"
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"
printDivider
if [ -e ~/google-cloud-sdk ]; then
echo "✔ ~/google-cloud-sdk exists. Skipping"
@adamlaz
adamlaz / splitter.sh
Created February 15, 2021 21:10
Split up big csv files
#!/bin/bash
FILENAME=big-file.csv
HDR=$(head -1 $FILENAME)
split -l 400 $FILENAME xyz
n=1
for f in xyz*
do
if [ $n -gt 1 ]; then
echo $HDR > Part${n}.csv
fi
@adamlaz
adamlaz / config.js
Created September 3, 2020 01:57 — forked from codediodeio/config.js
Snippets from the Firestore Data Modeling Course
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
@adamlaz
adamlaz / theme-colors.html
Created November 11, 2018 23:42 — forked from steve-taylor/theme-colors.html
Theme color chooser
<!doctype html>
<html>
<head>
<style>
html, body {
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Roboto, 'Segoe UI', sans-serif;
}
.color-grid {
display: grid;
@adamlaz
adamlaz / adamsGitCommitGuidelines.md
Last active March 10, 2023 01:17
My ideal git commit guidelines

Git Commit Guidelines We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the AngularJS change log.

Commit Message Format Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

():

@adamlaz
adamlaz / tinderSwipe.js
Last active September 1, 2018 23:57
For Tinder... Open up web UI and execute this in console. It automatically likes profile each second.
// This selects the right swipe button class name, and keeps clicking once a second.
func = setInterval(function() {
var swype = document.getElementsByClassName("recsGamepad__button--like")
swype[0].click()
}, 100)