Skip to content

Instantly share code, notes, and snippets.

View temoki's full-sized avatar
🐢

Tomoki Kobayashi temoki

🐢
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@temoki
temoki / main.dart
Created December 26, 2022 23:49
[Flutter tips] Themeで囲ってデフォルトのアイコンサイズを変える
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return MaterialApp(
title: 'Test',
@temoki
temoki / All_POSIXErrorCode.swift
Created July 21, 2020 06:56
All POSIXErrorCode
import Foundation
let allCodes: [(POSIXErrorCode, String)] = [
(.E2BIG,"E2BIG"),
(.EACCES,"EACCES"),
(.EADDRINUSE,"EADDRINUSE"),
(.EADDRNOTAVAIL,"EADDRNOTAVAIL"),
(.EAFNOSUPPORT,"EAFNOSUPPORT"),
(.EAGAIN,"EAGAIN"),
(.EALREADY,"EALREADY"),
@temoki
temoki / All_NSCocoaErrorDomain.swift
Created July 21, 2020 06:31
All NSCocoaErrorDomain
import Foundation
let allCodes: [(Int, String)] = [
(NSFileNoSuchFileError,"NSFileNoSuchFileError"),
(NSFileLockingError,"NSFileLockingError"),
(NSFileReadUnknownError,"NSFileReadUnknownError"),
(NSFileReadNoPermissionError,"NSFileReadNoPermissionError"),
(NSFileReadInvalidFileNameError,"NSFileReadInvalidFileNameError"),
(NSFileReadCorruptFileError,"NSFileReadCorruptFileError"),
(NSFileReadNoSuchFileError,"NSFileReadNoSuchFileError"),
@temoki
temoki / All_OSStatus.swift
Last active July 21, 2020 06:17
All OSStatus in Security.framework
import Foundation
let statuses: [(OSStatus, String)] = [
(errSecSuccess,"errSecSuccess"),
(errSecUnimplemented,"errSecUnimplemented"),
(errSecDiskFull,"errSecDiskFull"),
// (errSecDskFull,"errSecDskFull"), // Deprecated
(errSecIO,"errSecIO"),
(errSecOpWr,"errSecOpWr"),
(errSecParam,"errSecParam"),
@temoki
temoki / Error_as_NSError.swift
Last active July 21, 2020 05:56
Error as NSError
import Foundation
struct StructError: Error {
var localizedDescription: String { "StructError.localizedDescription" }
}
class ClassError: Error {
var localizedDescription: String { "ClassError.localizedDescription" }
}
@temoki
temoki / SendSynchronously.swift
Last active January 26, 2018 15:25
Execute `APIKit.Session.send(_:callbackQueue:handler:)` synchronously.
import APIKit
import Result
extension APIKit.Session {
class func sendSynchronous<Request>(_ request: Request) -> Result<Request.Response, APIKit.SessionTaskError> where Request: APIKit.Request {
return shared.sendSynchronous(request)
}
/// Execute `send(_:callbackQueue:handler:)` synchronously.
@temoki
temoki / UIImage+Extension.swift
Created October 23, 2017 02:17
UIImage+Extension
extension UIImage {
public func cropped(to rect: CGRect) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(rect.size, true, scale)
draw(at: rect.origin.applying(CGAffineTransform(scaleX: -1, y: -1)))
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
@temoki
temoki / holeView.swift
Created June 16, 2017 14:50
穴あきビュー
import UIKit
class HoleView: UIView {
override func awakeFromNib() {
super.awakeFromNib()
}
override func draw(_ rect: CGRect) {
super.draw(rect)