Skip to content

Instantly share code, notes, and snippets.

View jasenmichael's full-sized avatar

Jasen Michael jasenmichael

View GitHub Profile
@jasenmichael
jasenmichael / vite.config.ts.md
Created January 5, 2024 18:42
Folder as entry in library mode for multiple independent js modules
./src/
  src/cli.ts
  src/index.ts
./vite.config.ts

vite.config.ts

import { resolve } from "node:path"
@jasenmichael
jasenmichael / popos-get-docker.sh
Last active November 5, 2023 01:08
quickly install docker for pop_os (tested on 20.04)
#! /bin/bash
if [[ -z $1 ]] || [[ "$1" != "-r" ]] && [[ "$1" != "--reinstall" ]]; then
type docker >/dev/null 2>&1 && echo "Docker already installed, exiting" && exit 0
fi
echo "Installing Docker..."
sleep 2
# from the docker website - Install Docker Engine on Ubuntu
@jasenmichael
jasenmichael / boat.sh
Last active November 29, 2022 13:41
run docker container, mount local volume, and open terminal.
#!/bin/bash
type docker >/dev/null 2>&1 || { echo "Docker could not be found"; exit 1; }
function usage()
{
cat << EOF
Usage: $progname [--port NUM] [--dir STR] [--image STR]
optional arguments:
#!/bin/bash
## installs node 16.x
## install with:
## curl -fsSL https://tinyurl.com/install-node-16-pop-os | sudo -E bash -
sudo rm /etc/apt/sources.list.d/nodesource.list
sudo apt --fix-broken install
sudo apt update
@jasenmichael
jasenmichael / repo-reset.md
Created March 24, 2022 14:55 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@jasenmichael
jasenmichael / commit-message-format.md
Last active February 11, 2022 02:39
Simple Git Commit Message Format

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:

git commit -m "<type>: <subject>"

The header is mandatory and the scope of the header is optional.

@jasenmichael
jasenmichael / recursivly-convert-html-markdown.js
Last active January 11, 2022 02:59
recursivly convert html to markdown using nodejs
const fs = require("fs");
const path = require("path");
const glob = require("glob");
const TurndownService = require("turndown");
const turndownService = new TurndownService({
// options
headingStyle: "atx",
bulletListMarker: "-",
linkStyle: "referenced",
@jasenmichael
jasenmichael / collect-data.html
Created October 30, 2021 22:26
collect-data.html - ipData, browserInfo, os, date, location
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
;
(async () => {
// get browserInfo
let nVer = navigator.appVersion;
let nAgt = navigator.userAgent;
@jasenmichael
jasenmichael / simple-map-defer.php
Last active August 7, 2021 21:51 — forked from nfsarmento/simple-map-defer.php
WordPress defer javascript filter
/**
* defer javascript!
*
*/
function defer_parsing_of_js($url)
{
if (FALSE === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return "$url' defer ";
}
@jasenmichael
jasenmichael / wp_stubs.php
Last active August 3, 2021 20:40
to get VsCode snippets and intellesense for wordpress and acf php functions - add this file to your theme or plugin directory and install PHP Intelephense vscode extention.
<?php
/**
* to get VsCode snippets and intellesense for wordpress and acf php functions
* add this file to your theme or plugin directory and install PHP Intelephense vscode extention.
*
* Generated stub declarations for WordPress.
* https://wordpress.org
* https://gist.githubusercontent.com/jasenmichael/851282b82c7059e41a9a89efcaf1f6ce/raw/d841c986ec1e11aa3b73b2203dd6e08ede17cafc/wp_stubs.php
*/