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
| // ⚠️ As of WWDC21 you can just use a SwiftUI Material | |
| // https://developer.apple.com/documentation/swiftui/material | |
| // | |
| // Frost.swift | |
| // | |
| // Created by Clarko on 7/19/20. | |
| // | |
| // A SwiftUI representation of UIVisualEffectView | |
| // and UIBlurEffect, that handles mostly like a | |
| // SwiftUI Color view. Use it as a .background() |
| import Foundation | |
| protocol Channel: IteratorProtocol { | |
| func send(_ value: Element?) | |
| } | |
| /// A blocking channel for sending values. | |
| /// | |
| /// `send` and `receive` must run in separate separate execution contexts, otherwise you get a deadlock. | |
| final class BlockingChannel<A>: Channel { |
| // UICollectionView Objective-C example | |
| - (void)viewWillAppear:(BOOL)animated { | |
| [super viewWillAppear:animated]; | |
| NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
| if (selectedIndexPath != nil) { | |
| id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
| if (coordinator != nil) { | |
| [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
| // Promise.all is good for executing many promises at once | |
| Promise.all([ | |
| promise1, | |
| promise2 | |
| ]); | |
| // Promise.resolve is good for wrapping synchronous code | |
| Promise.resolve().then(function () { | |
| if (somethingIsNotRight()) { | |
| throw new Error("I will be rejected asynchronously!"); |
Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets
“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”
You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?
| var red = '#c00' | |
| var white = '#fff' | |
| console.log('<table border=0 cellspacing=0 cellpadding=0 style="line-height:10px">\n' + ([ | |
| '111111111111111111', | |
| '1 1 1 1', | |
| '1 1 1 1 1 1 1 1', | |
| '1 1 1 1 1 1 1 1', | |
| '1 1 1 1 1 1 1', | |
| '111111 1111111111', |
| // Load Ember into the global scope by requiring it | |
| require('ember'); | |
| // Go have fun | |
| var app = Ember.Application.create(); |