Skip to content

Instantly share code, notes, and snippets.

@arx8x
arx8x / theme.swift
Created June 22, 2020 14:57
Theme, ThemeManager, Themeable
//
// Theme.swift
// SHSH Host
//
// Created by ninja on 31/12/19.
// Copyright © 2019 arx8x.net. All rights reserved.
//
import UIKit
@arx8x
arx8x / TimeDuration.swift
Last active September 14, 2021 15:00
math operations on time
enum TimeDuration
{
case days(_: UInt)
case hours(_: UInt)
case minutes(_: UInt)
case seconds(_: UInt)
case muxed([TimeDuration])
case zero
var rawValue: UInt
from PIL import Image
# 0.2 = take max 20% of the canvas size
thumbnail_factor = 0.2
watermark_padding = 0.05
# (w, h)
POS_TOPLEFT = (0, 0)
POS_TOPRIGHT = (1, 0)
POS_BOTTOMLEFT = (0, 1)
@arx8x
arx8x / control_flow_1.py
Last active November 20, 2022 09:20
notes to myself (in case I move away from python and come back after a long while) and for beginners
# Might not seem like a big deal in the example but in
# big projects where there's a lot of control flows branching out
# into unmanageable mess, this will be useful.
# Biggest takeaway is, try to terminate/break/eliminate an edge case in a block and
# continue the expected control flow in the same indentation level (previous block)
a = {
'name': 'John Doe',
'age': '33',
@arx8x
arx8x / example1.py
Created November 22, 2022 04:03
Simple control flow tactics - for while
# This program goes through dictionary of lists containing
# different students in different divisions of a classs
# and finds a single student who has passed with above 80% score
divisions = {
'division A': [
{'name': 'Student 1', 'pass': False, 'percent': 10},
{'name': 'Student 2', 'pass': True, 'percent': 50},
{'name': 'Student 3', 'pass': True, 'percent': 77},
{'name': 'Student 4', 'pass': True, 'percent': 90}