Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Writing code one line at a time

Ben T othyn

🚀
Writing code one line at a time
View GitHub Profile
@qoomon
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 https://www.youtube.com/playlist?list=WL
// #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() {
const REMOVE_BUTTON_TEXT_MAP = {
View Gradient.swift
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State var gradientAngle: Double = 0
var colors = [
Color(UIColor.systemRed),
Color(UIColor.systemOrange),
Color(UIColor.systemYellow),
Color(UIColor.systemGreen),
@CodingMonkTech
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/
EXPOSE 9000
@Amzd
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
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
tonyxu-io / pkce-generator.html
Last active Jul 22, 2021
PKCE Code Verifier and Code Challenge Generator. DEMO:https://tonyxu-io.github.io/pkce-generator/
View pkce-generator.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<script>
function generateCodeVerifier() {
var code_verifier = generateRandomString(128)
document.getElementById("code_verifier").value = code_verifier
}
@fhuitelec
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
fi
@troyharvey
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
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@tweetjay
tweetjay / .swiftlint.yml
Created Oct 24, 2017
Swiftlint configuration file
View .swiftlint.yml
included:
excluded:
- Pods
- Cartography
- build
disabled_rules: # rule identifiers to exclude from running
# - cyclomatic_complexity
- trailing_whitespace
@lukestanley
lukestanley / tree.py
Created Jun 5, 2017
Use Python's built in tk to view Python dict as a tree, with collapsing and such
View tree.py
# Credit to https://stackoverflow.com/a/22722889/122364
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):