This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { quintOut } from 'svelte/easing'; | |
/** @param {number | string} value | |
* @returns {[number, string]} | |
*/ | |
function split_css_unit(value) { | |
const split = typeof value === 'string' && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); | |
return split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px']; | |
} | |
export { split_css_unit }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { onMount } from 'svelte'; | |
export let colors: string[] = ['#FFF', '#FFF', '#541161', '#8114B0', '#9F46CE', '#FFF']; | |
interface Options { | |
cellWidth: number; | |
cellHeight: number; | |
cellCount: { | |
x: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { spring } from 'svelte/motion'; | |
export let position = { x: 0, y: 0 }; | |
let dragging = false; | |
const start = () => { | |
dragging = true; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type QueueItem<T> = | |
| { status: 'idle'; } | |
| { status: 'uploading'; progress: number; } | |
| { status: 'done'; url: string; file: T; } | |
| { status: 'error'; error: Error; }; | |
type QueueItem = { | |
id: number; | |
} & (QueueItemUpload | QueueItemDone | QueueItemError); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xcrun simctl openurl booted "my.app.com://deeplink" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static let book: Font = { | |
// Font features | |
let fontFeatureSettings: [CFDictionary] = [ | |
[ | |
kCTFontFeatureTypeIdentifierKey: kTypographicExtrasType, | |
kCTFontFeatureSelectorIdentifierKey: kSlashedZeroOnSelector | |
] as CFDictionary | |
] | |
// Font description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
withAnimation(.interactiveSpring(response: 0.15, dampingFraction: 0.45, blendDuration: 0.5)) { | |
// | |
} | |
withAnimation(.interpolatingSpring( | |
mass: 1, | |
stiffness: 200, | |
damping: 20, | |
initialVelocity: 20)) { | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Text((startDate..<endDate).formatted(.components(style: .wide)).capitalized) | |
Text(endDate.formatted(.relative(presentation: .numeric, unitsStyle: .spellOut))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example use: | |
// let progress = val.clamped(to: 0...1) | |
extension Comparable { | |
func clamped(to limits: ClosedRange<Self>) -> Self { | |
return min(max(self, limits.lowerBound), limits.upperBound) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct EvolutionProposal: Codable { | |
var id: String | |
var title: String | |
var reviewStartDate: Date | |
var reviewEndDate: Date | |
enum CodingKeys: String, CodingKey { |
NewerOlder