Skip to content

Instantly share code, notes, and snippets.

View kichiemon's full-sized avatar
🌴
I’m on Fiji time!

terasaka kichiemon

🌴
I’m on Fiji time!
View GitHub Profile
extension UIView {
func drawCircle() {
let circlePath = UIBezierPath(ovalIn: self.bounds)
let circleShape = CAShapeLayer(layer: self.layer)
circleShape.frame = self.bounds
circleShape.path = circlePath.cgPath
circleShape.strokeColor = ColorName.primary.color.cgColor
circleShape.fillColor = Color.clear.cgColor
circleShape.lineWidth = 0.8
xcrun swift -version
@kichiemon
kichiemon / Info.plist
Last active November 27, 2019 14:18
default Info.plist created by Xcode.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- 言語設定:既定の言語・地域を言語IDで指定する。デフォルトは、en-US が設定されている。e.g. ja_JP -->
<!-- The default language and region for the bundle, as a language ID. -->
<!-- https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundledevelopmentregion -->
<!--
For a language used in many regions, use a code that represents a language designator.
To specify English, use the en language designator.
@kichiemon
kichiemon / Info.plist
Last active November 27, 2019 14:32
Info.plist for SwiftUI
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
@kichiemon
kichiemon / project.yml
Created November 27, 2019 14:35
project.yaml for XcodeGen
name: ApplicationName
options:
bundleIdPrefix: jp.kichiemon
targets:
ApplicationName:
type: application
platform: iOS
deploymentTarget: "13.0"
sources:
- path: ApplicationName
@kichiemon
kichiemon / echo_xcode_uuid.sh
Created January 18, 2020 01:04
Check Xcode UUID. e.g. `./echo_xcode_uuid.sh Xcode.app`
#!/bin/sh
if [ $# = 1 ]; then
echo $(/usr/libexec/PlistBuddy -c 'Print DVTPlugInCompatibilityUUID' "/Applications/$1/Contents/Info.plist")
else
echo $(/usr/libexec/PlistBuddy -c 'Print DVTPlugInCompatibilityUUID' "/Applications/Xcode.app/Contents/Info.plist")
fi
@kichiemon
kichiemon / replace_undefined_content_type
Created January 24, 2020 03:50
replace undefined content type
grep -R "Content-Type\': undefined" ./* -l | xargs sed -i -e 's|Content-Type\\\': undefined|Content-Type\\\': \'application/x-www-form-urlencoded;application/json;charset=utf-8\'|g
fun <A, B> LiveData<A>.combineLatestWith(other: LiveData<B>): LiveData<Pair<A, B>> {
val mediator = MediatorLiveData<Pair<A, B>>()
mediator.addSource(this) {
it?.let { thisValue ->
other.value?.let { otherValue ->
mediator.value = Pair(thisValue, otherValue)
}
}
}
mediator.addSource(other) {
@kichiemon
kichiemon / flutter_modal_push_page.dart
Last active February 19, 2020 15:00
flutter_modal_push_page: The key point is `fullscreenDialog: true,`
Navigator.push(
context,
new MaterialPageRoute(
builder: (BuildContext context) => NextPage(),
fullscreenDialog: true,
),
)
@override
Future<void> settings({
bool persistenceEnabled,
String host,
bool sslEnabled,
int cacheSizeBytes,
}) async {
await channel.invokeMethod<void>('Firestore#settings', <String, dynamic>{
'app': app.name,
'persistenceEnabled': persistenceEnabled,