Skip to content

Instantly share code, notes, and snippets.

View TonyTang2001's full-sized avatar
💭
I may be slow to respond.

TonyTang TonyTang2001

💭
I may be slow to respond.
View GitHub Profile
@jordansinger
jordansinger / Settings.swift
Created February 20, 2021 18:30
iOS 6 Settings built in SwiftUI
//
// Settings.swift
// Settings
//
// Created by Jordan Singer on 2/20/21.
//
import SwiftUI
struct Settings: View {
@davidsteppenbeck
davidsteppenbeck / PreviewProviderModifier.swift
Last active October 31, 2022 10:30
A SwiftUI view modifier for simple preview providers.
import SwiftUI
enum PreviewProviderMode: CaseIterable {
/// Use for a light appearance preview.
case lightMode
/// Use for a dark appearance preview.
case darkMode
@Priva28
Priva28 / GradientEffect.swift
Last active December 1, 2023 04:43
Gradient effect to emulate Apple Music Lyrics/Now Playing screen.
//
// ContentView.swift
// GradientEffect
//
// Created by Christian Privitelli on 18/7/20.
//
import SwiftUI
struct ContentView: View {
@avaidyam
avaidyam / BackdropView.swift
Created July 2, 2020 17:23
DIY NSVisualEffectView using Private API for macOS
// TODO: setting window transforms (or mission control) flattens layers...
// TODO: Mask image vs path (layer)?
/// `NSVisualEffectView`:
///
/// A view that adds translucency and vibrancy effects to the views in your interface.
/// When you want views to be more prominent in your interface, place them in a
/// backdrop view. The backdrop view is partially transparent, allowing some of
/// the underlying content to show through. Typically, you use a backdrop view
/// to blur background content, instead of obscuring it completely. It can also
@jordansinger
jordansinger / macOS.swift
Last active September 5, 2024 01:58
macOS SwiftUI Playgrounds code
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}
# setup
# pip install cryptography pyjwt
# ref.
# http://gobiko.com/blog/token-based-authentication-http2-example-apns/
import jwt
import time
ALGORITHM = 'ES256'
@tadija
tadija / FontNames-iOS-17.4.swift
Last active August 26, 2024 04:47
iOS - All Font Names
/*
*** Academy Engraved LET ***
AcademyEngravedLetPlain
---------------------
*** Al Nile ***
AlNile
AlNile-Bold
---------------------
*** American Typewriter ***
AmericanTypewriter
@TylerRick
TylerRick / group-required-by-name.js
Created May 22, 2012 02:18
'group-required-by-name' to require at least one checkbox in a group to be checked
//--------------------------------------------------------------------------------------------------
// This is based on the 'group-required' rule from js-webshim/dev/extras/custom-validity.js but
// allows you to specify a group name, in case you need checkboxes with different names in the same
// group.
var groupTimer = {};
$.webshims.addCustomValidityRule('group-required-by-name', function(elem, val){
var $elem = $(elem);
var name = $elem.data('group-required');
var filter = '[data-group-required="' + name + '"]'
if (!name || elem.type !== 'checkbox') { return; }