Skip to content

Instantly share code, notes, and snippets.

View viraf's full-sized avatar

Viraf Sarkari viraf

View GitHub Profile
import Foundation
import SwiftUI
// MARK: - Custom Button Style
struct MobileMeButtonStyle: ButtonStyle {
// MARK: Metrics
@ScaledMetric private var cornerRadius = 12
@ScaledMetric private var horizontalLabelPadding = 12
@ScaledMetric private var verticalLabelPadding = 8
@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
@jzucker2
jzucker2 / AppDelegate10.m
Last active July 14, 2022 08:55
UserNotifications on iOS 10
// Make sure to include this at the top of AppDelegate.m
@import UserNotifications;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Check Notification Settings on launch
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
switch (settings.authorizationStatus) {
// This means we have not yet asked for notification permissions
case UNAuthorizationStatusNotDetermined:
@demonbane
demonbane / makeapp.sh
Created July 5, 2011 20:05
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"