January 6, 2013
I recently saw a post on Twitter from @chpwn that described the alogorithm that Apple uses for its “rubber band” or “bungee” scrolling.
b = (1.0 – (1.0 / ((x * c / d) + 1.0))) * d
| // | |
| // NSApplication+openSettings.swift | |
| // | |
| // Created by Stephan Casas on 12/3/23. | |
| // | |
| import SwiftUI; | |
| fileprivate let kAppMenuInternalIdentifier = "app" | |
| fileprivate let kSettingsLocalizedStringKey = "Settings\\U2026"; |
| extension UIHostingController { | |
| convenience public init(rootView: Content, ignoreSafeArea: Bool) { | |
| self.init(rootView: rootView) | |
| if ignoreSafeArea { | |
| disableSafeArea() | |
| } | |
| } | |
| func disableSafeArea() { |
| let googleApiKey = '' // Insert your own key for Google Maps + Directions JS SDK here | |
| let copenhagenBounds = {minLat: 55.5, minLong: 12.5, maxLat: 55.8, maxLong: 12.7} | |
| let copenhagenCenter = {lat: copenhagenBounds.maxLat - copenhagenBounds.minLat, lng: copenhagenBounds.maxLong - copenhagenBounds.minLong} | |
| let getLocation = Location.current() | |
| // const getLocation = new Promise(resolve => resolve({latitude: 55.7, longitude: 12.5})) // hardcoded location resolver for airplane debug use | |
| const [allTIERScooters, allVOIScooters, myLocation] = await Promise.all([getTIERScooters(copenhagenBounds), getVOIScooters(copenhagenBounds), getLocation]) | |
| console.log('My location: ' + JSON.stringify(myLocation)) | |
| if (allTIERScooters.length + allVOIScooters.length <= 0) { |
| import UIKit | |
| class MyTextLabel: UIView { | |
| var textLayer = CATextLayer() | |
| var textStorage: String = "" { | |
| didSet { | |
| textLayer.string = textStorage | |
| } | |
| } |
| /* | |
| Copyright (c) 2017 Chris Patuzzo | |
| https://twitter.com/chrispatuzzo | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| /* | |
| * This work is free. You can redistribute it and/or modify it under the | |
| * terms of the Do What The Fuck You Want To Public License, Version 2, | |
| * as published by Sam Hocevar. See the COPYING file for more details. | |
| */ | |
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { |