Skip to content

Instantly share code, notes, and snippets.

@dejager
dejager / RoundedPolygon.swift
Created October 18, 2022 05:57
A SwiftUI Shape that draws a polygon with a given number of corners and a corner radius.
//
// RoundedPolygon.swift
//
// Created by Nate on 2022-10-17.
//
import SwiftUI
struct RoundedPolygon: Shape {
@joshdholtz
joshdholtz / Fastfile
Created May 28, 2020 15:57
fastlane - Get TestFlight Feedback
lane :connect_feedback do
fastlane_require 'spaceship'
Spaceship::Tunes.login
Spaceship::Tunes.select_team
# Gets app
app = Spaceship::ConnectAPI::App.find(ENV["TEST_APP_BUNDLE"])
# Gets feedback for an app (default includes screenshots and tester info)
@marcoarment
marcoarment / apns_jwt_token.php
Last active April 14, 2024 06:49
Generate ES256 JWT tokens for Apple Push Notification Service (APNS) in PHP
<?php
function base64url_encode($binary_data) { return strtr(rtrim(base64_encode($binary_data), '='), '+/', '-_'); }
function apns_jwt_token($team_id, $key_id, $private_key_pem_str)
{
if (! function_exists('openssl_get_md_methods') || ! in_array('sha256', openssl_get_md_methods())) throw new Exception('Requires openssl with sha256 support');
$private_key = openssl_pkey_get_private($private_key_pem_str);
if (! $private_key) throw new Exception('Cannot decode private key');
import Foundation
extension Locale {
func localizedCurrencySymbol(forCurrencyCode currencyCode: String) -> String? {
guard let languageCode = languageCode, let regionCode = regionCode else { return nil }
/*
Each currency can have a symbol ($, £, ¥),
but those symbols may be shared with other currencies.
For example, in Canadian and American locales,
@nickffox
nickffox / Keyboard.swift
Created August 16, 2019 18:43
Adjusting a SwiftUI View for the Keyboard.
import Combine
final class Keyboard: ObservableObject {
// MARK: - Published Properties
@Published var state: Keyboard.State = .default
// MARK: - Private Properties