Skip to content

Instantly share code, notes, and snippets.

View jsjoeio's full-sized avatar

Joe Previte jsjoeio

View GitHub Profile
@jsjoeio
jsjoeio / staticServer.ts
Last active May 4, 2021 15:16
oak - example static server which checks for HTML files with same name as directory for Next.js
/*
* This is an example of a server that will serve static content out of the
* $CWD/examples/static path.
*/
import {
bold,
cyan,
green,
red,
@jsjoeio
jsjoeio / test.yml
Created April 2, 2021 03:09
Test Workflow
name: Test
on:
schedule:
- cron: "*/5 * * * *"
jobs:
job1:
name: Debug2
runs-on: ubuntu-latest
@jsjoeio
jsjoeio / README.md
Last active February 9, 2021 22:54
Coder Environments - How to set zsh as your default shell

How to set zsh as your default shell

  1. Create a .bashrc file with the contents below
# Note: this is included because of a weird bug
# Seems to be the only way to make zsh the correct shell
# See: https://askubuntu.com/a/1292415
export SHELL=`which sh`
zsh
exit
@jsjoeio
jsjoeio / run-multiple-tests.sh
Last active January 21, 2025 20:16
How to Run a Jest test multiple times
#!/usr/bin/env bash
i=1
successes=0
failures=0
totalTests=10
SUCCESS_CHECKMARK=$(printf '\342\234\224\n' | iconv -f UTF-8)
CROSS_MARK=$(printf '\342\235\214\n' | iconv -f UTF-8)
OUTPUT_FILE="jestOutput.txt"
until [ $i -gt $totalTests ]; do
@jsjoeio
jsjoeio / README.md
Last active March 31, 2021 20:26
Calculate Fitbit Monthly Stats - Duration

Calculate Fitbit Monthly Stats - Duration

Unfortunately, the "Track My Activities on Fitbit" doesn't calculate the total hours (using duration) so I wrote a script that you can run in the console on the page to calculate the total.

(defn big
"tells you whether or not the string is bigger than n"
[st, n]
(if (> (int (count st)) n) "That's a big string!" "That's a small string")
)
@jsjoeio
jsjoeio / migration.sh
Created July 3, 2020 04:02
Migration script - rename files to kebab-lowercase and add a heading to the start
# Loop over all markdown files
for file in *.md
do
# Remove the file extension
filename=${file%.*}
# Create new filename it by replacing spaces with - and lowercasing it
@jsjoeio
jsjoeio / .zshrc
Created June 16, 2020 16:55
Obsidan - sync with git
# function to push to git
function gitpush() {
git add .
git commit -a -m "add notes"
git push
}
# aliases
alias vault="cd dev/obsidian-vault && git pull"
alias vaultpush="cd dev/obsidian-vault && gitpush"
@jsjoeio
jsjoeio / my-cool-recipe.mdx
Last active May 9, 2020 22:34
Gatsby Recipe: Generate a Blog Post Faster with Hygen

Generate a Blog Post Faster with Hygen

Hygen is a code generator that saves you time.

You can save yourself time by using it to generate a blog post template so you can start writing faster.


Install hygen, day.js, and open npm packages

@jsjoeio
jsjoeio / index.ejs.t
Created May 9, 2020 22:19
Gatsby Recipe: Generate a Blog Post Faster with Hygen - index.ejs.t
---
to: content/<%= folderName %>/index.md
---
---
slug: "<%= slug %>"
date: "<%= date %>"
title: "<%= h.inflection.titleize(title) %>"
description: "<%= description %>"
published: false
---