Skip to content

Instantly share code, notes, and snippets.

@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active April 26, 2024 19:34
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@ryanlintott
ryanlintott / LayoutThatFits.swift
Last active December 8, 2023 15:14
An alternative to ViewThatFits. Updated version can be found here: https://github.com/ryanlintott/LayoutThatFits
//
// LayoutThatFits.swift
// WWDC22Experiments
//
// Created by Ryan Lintott on 2022-06-08.
//
import SwiftUI
struct LayoutThatFits: Layout {
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
let referenceSize = UIFont.preferredFont(forTextStyle: .body,
compatibleWith: .init(preferredContentSizeCategory: .medium))
let newSize = UIFont.preferredFont(forTextStyle: .body)
let percentIncrease = (newSize.pointSize / referenceSize.pointSize) * 100
let js = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='\(Int(percentIncrease))%'"
webView.evaluateJavaScript(js) { _, error in
@levelsio
levelsio / git_graph.php
Last active June 5, 2023 03:49
GitHub style graph in PHP + CSS
<style>
.git-graph {
text-align: left;
line-height: 1;
}
.git-graph-row {
clear: both;
text-align: left;
}
.git-graph-cell {
@sonnylazuardi
sonnylazuardi / code.ts
Created June 11, 2021 04:27
Resizable Figma Plugin Window
figma.showUI(__html__,{width: 250, height: 250});
// restore previous size
figma.clientStorage.getAsync('size').then(size => {
if(size) figma.ui.resize(size.w,size.h);
}).catch(err=>{});
figma.ui.onmessage = msg => {
switch (msg.type) {
case "resize":
figma.ui.resize(msg.size.w,msg.size.h);
figma.clientStorage.setAsync('size', msg.size).catch(err=>{});// save size
@ryanlintott
ryanlintott / CustomColorScheme.swift
Last active April 23, 2024 09:54
Custom color scheme view modifier for SwiftUI. Sets the color scheme to light mode, dark mode, or matches the system. If set to match, the app will respond to system-wide color scheme changes properly. A simple widget color scheme implementation is also provided.
import SwiftUI
enum CustomColorScheme: Int, CaseIterable, Identifiable, Codable {
static var defaultKey = "customColorScheme"
static var defaultValue = CustomColorScheme.system
case system = 0
case light = 1
case dark = 2
@Bert-Proesmans
Bert-Proesmans / qos-all.auto.rsc
Last active January 25, 2024 06:18
Mikrotik Routerboard QOS script
# Creation Date: November 3, 2018
:local Version "2.0"
:local LASTUPDATE "05/10/2019"
# Tested with RouterOS 6.43.4
#
# Mikrotik script to implement QoS on internet connections.
# The script makes use of Address Lists, Firewall rules (Mangle) for connection tagging, and Queue Trees.
# The script will remove applied rules from previous runs before applying.
#
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active May 10, 2024 13:31
crack activate Office on mac with license file
@drschwabe
drschwabe / package.json
Last active June 22, 2021 22:20
Watchify (Browserify) a JS file that has modules loading in both Common ('require') and ES6 ('import ... from ')
{
"name": "my-app-using-require-and-imports-same-codebase",
"scripts": {
"watch": "./node_modules/.bin/watchify client.js -t [ babelify --global --sourceType unambiguous --presets ['@babel/preset-env' ] ] -o client.bundle.js -d -v",
"compile": "./node_modules/.bin/browserify client.js -t [ babelify --global --sourceType unambiguous --presets ['@babel/preset-env' ] ] -o client.bundle.js",
"compress": "./node_modules/.bin/uglifyjs client.bundle.js --compress --mangle -o client.bundle.js",
"start": "node server.js"
},
"devDependencies": {
"@babel/polyfill": "^7.4.4",
@booty
booty / BudgetAudiophile.md
Last active April 30, 2021 11:28
Standard responses for /r/BudgetAudiophile

Speakers

Buying locally used is a great option. Just make sure to be safe (duh) and individually demo the speakers before you buy. Buying affordable speakers used online is tough due to shipping costs; they can easily run $50-$100 or higher which kind of kills the value.

Our own sidebar guides are a great resource for bookshelf speakers/ and tower speakers.

This roundup of bookshelf speakers at TheWirecutter is a good place to get started. There are some notable omissions, but it's fairly comprehensive and (most importantly) it offers some background about what to look for.

Speakers (Compact)