This file contains hidden or 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
| var mediaJSON = { "categories" : [ { "name" : "Movies", | |
| "videos" : [ | |
| { "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
| "subtitle" : "By Blender Foundation", | |
| "thumb" : "images/BigBuckBunny.jpg", | |
| "title" : "Big Buck Bunny" | |
| }, | |
| { "description" : "The first Blender Open Movie from 2006", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) | |
| } | |
| } |
NewerOlder