Skip to content

Instantly share code, notes, and snippets.

View patricknelson's full-sized avatar
:shipit:
Pushing 1's and 0's.

Patrick Nelson patricknelson

:shipit:
Pushing 1's and 0's.
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>🔥 Make a photo booth app in about 15 lines of JavaScript</title>
<link rel="icon" href="https://fav.farm/🎥" />
</head>
<body>
@bubba-h57
bubba-h57 / instructions.md
Last active October 23, 2023 12:46
Configuring Jetbrains Gateway and WSL

Step 1: SSH Daemon

In your WSL instance, re-install OpenSSH server as follows.

sudo apt remove --purge openssh-server
sudo apt install openssh-server

Edit /etc/ssh/sshd_config (e.g. sudo vi /etc/ssh/sshd_config) and add the following lines to the bottom of the file. Ensure you replace WSL_ACCOUNT_NAME with your WSL2 account name.

@AdamManuel-dev
AdamManuel-dev / Svelte Custom Element v1 Wrapper
Last active April 28, 2023 21:35
This is a wrapper for turning a Svelte Component built as an entry point into a Web Component using the Custom Element v1 Spec
import Gallery from './COA/COAGallery.svelte';
/**
* C.O.A. Gallery Custom Element v1 Component Class
*/
class COAGallery extends HTMLElement {
/**
* This defines the attributes to watch in the custom element to trigger the `attributeChangedCallback` method
*/
static get observedAttributes() {
@danieldogeanu
danieldogeanu / RenameGitBranch.md
Last active April 24, 2024 17:19
How to rename your Git master branch to main.

To rename your Git master branch to main, you must do the following steps:

  1. Navigate to your repository in the command line and issue the following commands: - git branch -m master main - git push -u origin main

  2. Change your default branch on GitHub by going to your GitHub repository in your browser, and navigate to Settings > Branches and click on the dropdown and switch from master to main and click Update (this will only show if you have two or more branches). The main branch is now your default branch.

  3. Update the tracking of the branch from your command line with the following command: - git branch -u origin/main main

@Ragnoroct
Ragnoroct / __fastgit_ps1.sh
Created February 26, 2020 19:45
Blazing fast simple git branch name for ps1
# Copyright (c) 2019 Will Bender. All rights reserved.
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Very fast __git_ps1 implementation
# Inspired by https://gist.github.com/wolever/6525437
# Mainly this is useful for Windows users stuck on msys, cygwin, or slower wsl 1.0 because git/fs operations are just slower
# Caching can be added by using export but PROMPT_COMMAND is necessary since $() is a subshell and cannot modify parent state.
# Linux: time __ps1_ps1 (~7ms)
@fffonion
fffonion / setup-dashbutton.py
Created September 28, 2019 22:32
Setting up dash button without Amazon App
import requests
import re
import sys
# Initial work from: https://mpetroff.net/2016/07/new-amazon-dash-button-teardown-jk29lp/
h = requests.Session()
BASE_URL = "http://192.168.0.1"
@liamfiddler
liamfiddler / style.11ty.js
Last active August 29, 2023 23:04
SCSS + PostCSS pipeline for 11ty
// sass dependencies: `npm i -D sass`
const util = require('util');
const sass = require('sass');
const renderSass = util.promisify(sass.render);
// postcss dependencies: `npm i -D autoprefixer postcss precss`
const autoprefixer = require('autoprefixer');
const postcss = require('postcss');
const precss = require('precss');
const postcssProcessor = postcss([precss, autoprefixer]);
@jakub-g
jakub-g / async-defer-module.md
Last active April 12, 2024 07:32
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@matthewpalmer
matthewpalmer / pod.yaml
Created July 21, 2018 04:13
kubernetes nginx php-fpm pod
# Create a pod containing the PHP-FPM application (my-php-app)
# and nginx, each mounting the `shared-files` volume to their
# respective /var/www/html directories.
kind: Pod
apiVersion: v1
metadata:
name: phpfpm-nginx-example
spec:
volumes:
@hisplan
hisplan / add-rsync-to-git-bash.md
Created February 21, 2018 09:02
Add rsync to git bash for windows