Kotlin 1.4 Online Event, October 12–15, 2020 で発表されたトークについてのメモ
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
// firebase authを使って、ログインユーザーが変わった時に何か取得する | |
export const Sample1: VFC = () => { | |
const [authState, setAuthState] = useState() | |
useEffect(() => { | |
if (!process.browser) return | |
let cancel = false | |
const unsubscribe = auth.onAuthStateChanged( | |
async firebaseUser => { |
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 'package:collection/collection.dart'; | |
import 'package:grinder/grinder.dart'; | |
void main(List<String> args) => grind(args); | |
@Task('Open Upgraded Package Changelog') | |
void openUpgradedPackageChangelog() { | |
_openUpgradedPackageChangelog( | |
[ | |
'.', |
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 UIKit | |
import PlaygroundSupport | |
protocol WaterfallLayoutDelegate: AnyObject { | |
func numberOfColumns() -> Int | |
func columnsSize(at indexPath: IndexPath) -> CGSize | |
func columnSpace() -> CGFloat | |
} | |
final class WaterfallLayoutViewController: UIViewController, UICollectionViewDataSource { |
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 UIKit | |
import PlaygroundSupport | |
protocol WaterfallLayoutDelegate: AnyObject { | |
func numberOfColumns() -> Int | |
func columnsSize(at indexPath: IndexPath) -> CGSize | |
func columnSpace() -> CGFloat | |
} | |
final class WaterfallLayoutViewController: UIViewController, UICollectionViewDataSource { |
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 UIKit | |
class HeaderView: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
setUp() | |
} | |
required init?(coder: NSCoder) { | |
super.init(coder: coder) |
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 UIKit | |
extension UIImage { | |
func resizeWith(percentage: CGFloat) -> UIImage? { | |
let imageView = UIImageView(frame: CGRect(origin: .zero, size: CGSize(width: size.width * percentage, height: size.height * percentage))) | |
imageView.contentMode = .scaleAspectFit | |
imageView.image = self | |
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, false, scale) | |
guard let context = UIGraphicsGetCurrentContext() else { return nil } |
休日 | 期日 | 適用開始年 | 適用終了年 |
---|---|---|---|
元日 | 1月1日 | 1948年7月20日 | - |
元始祭 | 1月3日 | 1873年10月14日 | 1948年7月20日 |
新年宴会 | 1月5日 | 1873年10月14日 | 1948年7月20日 |
成人の日 | 1月15日 | 1948年7月20日 | 2000年1月1日 |
成人の日 | 1月の第2月曜日 | 2000年1月1日 | - |
孝明天皇祭 | 1月30日 | 1873年10月14日 | 1912年 |
紀元節 | 2月11日 | 1873年10月14日 | 1948年7月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
extension CollectionType { | |
func shuffled() -> [Generator.Element] { | |
var source = Array(self) | |
var result : [Generator.Element] = [] | |
while !source.isEmpty { | |
let index = Int(arc4random()) % source.count | |
result.append(source[index]) | |
source.removeAtIndex(index) | |
} | |
return result |
NewerOlder