Skip to content

Instantly share code, notes, and snippets.

Writing code one line at a time

Ben T othyn

Writing code one line at a time
View GitHub Profile
qoomon / youtube_clean_watch_later_videos.js
Last active Oct 4, 2021
Clean YouTube Watch Later Videos
View youtube_clean_watch_later_videos.js
// This script will remove all videos from watch later list
// Usage
// #1 go to
// #2 run following script
// adjust REMOVE_BUTTON_TEXT_MAP if your language is missing
//. get you location code by executing document.documentElement.lang
(async function() {
View Gradient.swift
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State var gradientAngle: Double = 0
var colors = [
CodingMonkTech / Configurations for Laravel app on Kubernetes - Dockerfile
Last active Sep 22, 2021
Deploying laravel on kubernetes cluster - Ready to use configuration Files
View Configurations for Laravel app on Kubernetes - Dockerfile
FROM php:7.2-fpm
COPY app /var/www/
Amzd / Binding+didSet.swift
Last active May 1, 2021
SwiftUI Binding wrappers for willSet and didSet
View Binding+didSet.swift
extension Binding {
/// Wrapper to listen to didSet of Binding
func didSet(_ didSet: @escaping ((newValue: Value, oldValue: Value)) -> Void) -> Binding<Value> {
return .init(get: { self.wrappedValue }, set: { newValue in
let oldValue = self.wrappedValue
self.wrappedValue = newValue
didSet((newValue, oldValue))
sledsworth / NutrientModel.swift
Last active Apr 17, 2021
Generic Animated Progress Bar in SwiftUI
View NutrientModel.swift
import Foundation
import UIKit
import SwiftUI
import Combine
class NutrientModel: Progressable {
var willChange = PassthroughSubject<BaseNutrient, Never>()
var id = UUID.init()
var name: String
tonyxu-io / pkce-generator.html
Last active Jul 22, 2021
PKCE Code Verifier and Code Challenge Generator. DEMO:
View pkce-generator.html
<!DOCTYPE html>
<script src=""></script>
function generateCodeVerifier() {
var code_verifier = generateRandomString(128)
document.getElementById("code_verifier").value = code_verifier
fhuitelec / check_file_exists.zsh
Created Nov 25, 2017
[Check file exists] Cheatsheet to check if file exists #zsh #shell #cheatsheet
View check_file_exists.zsh
#!/usr/bin/env zsh
# Check file exists
if [ ! -f /tmp/foo.txt ]; then
echo "File not found!" >&2
exit 1
troyharvey / deployment.yml
Last active Oct 18, 2021
Using Kubernetes envFrom for environment variables
View deployment.yml
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
name: mans-not-hot
app: mans-not-hot
replicas: 1
tweetjay / .swiftlint.yml
Created Oct 24, 2017
Swiftlint configuration file
View .swiftlint.yml
- Pods
- Cartography
- build
disabled_rules: # rule identifiers to exclude from running
# - cyclomatic_complexity
- trailing_whitespace
lukestanley /
Created Jun 5, 2017
Use Python's built in tk to view Python dict as a tree, with collapsing and such
# Credit to
import uuid
import tkinter as tk
from tkinter import ttk
def json_tree(tree, parent, dictionary):
for key in dictionary:
uid = uuid.uuid4()
if isinstance(dictionary[key], dict):