Skip to content

Instantly share code, notes, and snippets.

@mariosaputra
mariosaputra / rcwebhook.js
Created March 3, 2024 08:56
RevenueCat Webhook
require("dotenv").config();
const express = require("express");
const axios = require("axios");
const app = express();
const port = 3000;
const TELEGRAM_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
const CHAT_ID = process.env.TELEGRAM_CHANNEL_ID;
const TELEGRAM_API_URL = `https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage`;
@steventroughtonsmith
steventroughtonsmith / VTBMainViewController.swift
Created July 21, 2023 16:31
visionOS Freeform-style bottom toolbar ornament
//
// VTBMainViewController.swift
// VisionToolbar
//
// Created by Steven Troughton-Smith on 21/07/2023.
//
//
import UIKit
import SwiftUI
class Content: NSManagedObject {
// MARK: - Mappable
func mapValues(using mapper: Mapping) throws {
let mapper = try mapper.mapper(for: self, destination: CKContent.self)
mapper.map(\.objectID, \.identifier, transform: { objectID -> String in
return objectID.uriRepresentation().absoluteString
})
mapper.map(\.name, \.name)
mapper.map(\.url, \.url)
mapper.map(\.downloadURLExpiry, \.downloadURLExpiry)
//
// ContentMapper.swift
//
//
// Created by Antoine van der Lee on 09/03/2021.
//
import Foundation
import ContentKit
.toolbar {
ToolbarItemGroup {
Button(action: {}, label: {
Image(systemName: "sidebar.left")
})
Spacer()
Button(action: {}, label: {
Image(systemName: "play.fill")
})
Button(action: {}, label: {
@shaps80
shaps80 / ActivityView.md
Last active December 3, 2022 15:36
A complete SwiftUI UIActivityViewController implementation.

Moved

This is now available in a dedicated package: ActivityView

Alternatively my SwiftUI Backports now includes a more complete implementation of ShareLink that's also more performant.

@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 27, 2025 14:38
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://bsky.app/profile/tholanda.com
*
* (the twitter account is now deleted, please, do not try to reach me there)
* https://twitter.com/tholanda
*
* MIT license
*/
@scottmatthewman
scottmatthewman / AdaptsToSoftwareKeyboard.swift
Last active April 19, 2024 12:56
An example of using Combine to automatically adapt a SwiftUI scrollable view to accommodate an iOS onscreen keyboard
import SwiftUI
import Combine
struct AdaptsToSoftwareKeyboard: ViewModifier {
@State var currentHeight: CGFloat = 0
func body(content: Content) -> some View {
content
.padding(.bottom, currentHeight)
.edgesIgnoringSafeArea(.bottom)
@shaildyp
shaildyp / UIView+roundCorners.swift
Last active December 7, 2022 12:14
Backward compatible maskedCorners of iOS 11.
extension UIView {
func roundCorners(_ corners: CACornerMask, radius: CGFloat) {
if #available(iOS 11, *) {
self.layer.cornerRadius = radius
self.layer.maskedCorners = corners
} else {
var cornerMask = UIRectCorner()
if(corners.contains(.layerMinXMinYCorner)){
cornerMask.insert(.topLeft)
@ianchen06
ianchen06 / ipsec_ikev2.md
Last active July 5, 2022 11:37
ikev2 ipsec vpn with letsencrypt certificate and ios/macOS native vpn compatibility