Skip to content

Instantly share code, notes, and snippets.

View sneakyness's full-sized avatar
💭
Rolling up to the function like a stretched out Steve Ballmer

Nick Pannuto sneakyness

💭
Rolling up to the function like a stretched out Steve Ballmer
View GitHub Profile
@fruitcoder
fruitcoder / CA+Extensions.swift
Last active September 17, 2021 16:23
Returns the simulator drag coefficient when Slow Animations are enabled, otherwise (and non simulator builds) 1.0
import UIKit
#if targetEnvironment(simulator)
@_silgen_name("UIAnimationDragCoefficient") func UIAnimationDragCoefficient() -> Float
func simulatorDragCoefficient() -> CFTimeInterval {
let drag = UIAnimationDragCoefficient()
if drag > 1 {
return CFTimeInterval(drag)
}
return 1
@chriseidhof
chriseidhof / boilerplate.swift
Last active January 3, 2024 05:54
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@douglashill
douglashill / updateSafeAreaForKeyboardFromNotification.swift
Last active June 25, 2023 16:11
Avoid the keyboard by leveraging additionalSafeAreaInsets.
// Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets.
// You can put this in the root view controller so the whole app will avoid the keyboard.
// Only tested on iOS 13.3.
// Made for https://douglashill.co/reading-app/
@objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) {
guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
return
}
// Please consider whether the force unwrap here is safe for your own use case.
@propertyWrapper
public struct AnyProxy<EnclosingSelf, Value> {
private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>
public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) {
self.keyPath = keyPath
}
@available(*, unavailable, message: "The wrapped value must be accessed from the enclosing instance property.")
public var wrappedValue: Value {
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@sorskoot
sorskoot / OBS RGB Glitch Shader.hlsl
Last active February 2, 2023 22:23
OBS RGB Glitch shader
uniform float speed;
uniform float stepsize;
uniform float amount;
float4 mainImage(VertData v_in) : TARGET
{
float time = elapsed_time*speed;
float glitch = 0;
if( frac(sin(time) * cos(v_in.uv.y*sin(time*1.45))) > amount) glitch=stepsize;
@richellis
richellis / Iconizer.sh
Last active September 15, 2021 22:42 — forked from steverichey/Iconizer.sh
Create iOS application icons from one PDF file. Requires ImageMagick.
#!/bin/sh
#
# Iconizer shell script by Steve Richey (srichey@floatlearning.com)
# Modified by Rich Ellis (rich@richellis.net) based on contributions on Github from crishoj, giria
# https://gist.github.com/steverichey/8493f3bd31ae71a9c933/forks
#
# This is a simple tool to generate all necessary app icon sizes and the JSON file for an *EXISTING* Xcode project from one file.
# To use: specify the path to your vector graphic (PDF format) and the path to your Xcode folder containing Images.xcassets
# Example: sh iconizer.sh MyVectorGraphic.pdf MyXcodeProject

Adding Method Cascades

  • Proposal: TBD
  • Author(s): Erica Sadun
  • Status: TBD
  • Review manager: TBD

Introduction

Method cascades offer a method-based counterpart to functional chaining. In functional chaining, partial results pass from one step to the next. In cascades, object scope is maintained through a series of sequential calls. Both approaches support fluent interfaces, providing readable streamlined code.

@elliottsj
elliottsj / uikit-apple-watch.md
Last active May 30, 2016 00:12
My attempt at getting UIKit to work on watchOS 2

Simple Security Guidelines

Using an iDevice? (Best option)

  • Use an iPod or an iPad without a SIM card
  • Use an iPhone
  • Do not jailbreak
  • Always upgrade to new iOS versions
  • Use Brave browser

Need Secure chat?