Skip to content

Instantly share code, notes, and snippets.

View ykws's full-sized avatar
🏠
Working from home

KAWASHIMA Yoshiyuki ykws

🏠
Working from home
View GitHub Profile
@ykws
ykws / MixedSuffixAndEllipsisText.kt
Created December 12, 2022 17:11
Jetpack Compose Text mixed a suffix and an ellipsis
@Composable
fun MixedSuffixAndEllipsisText(
text: String,
suffix: String,
) {
Row(modifier = Modifier.padding(all = 10.dp)
) {
Text(
text = text,
maxLines = 1,
@ykws
ykws / home.swift
Last active October 28, 2021 09:10
Run SwiftUI on Playground
import PlaygroundSupport
import SwiftUI
struct Home: View {
var body: some View {
Text("Hello, world!")
}
}
let viewController = UIHostingController(rootView: Home())
@ykws
ykws / AudioServicesPlaySystemSoundExample.swift
Created February 10, 2020 18:31
iOS app vibrate with AudioServicesPlaySystemSound
// AudioServicesPlaySystemSound
// https://developer.apple.com/documentation/audiotoolbox/1405248-audioservicesplaysystemsound
import AudioToolbox
// A list of SystemSoundID
// http://iphonedevwiki.net/index.php/AudioServices
//
AudioServicesPlaySystemSound(1000)
@ykws
ykws / AnyManager.m
Created January 21, 2020 03:20
SharedManager by Objective-C
@implementation AnyManager
+ (instancetype)sharedManager {
static AnyManager *_sharedManager = nil;
static dispatch_once_t oncePredicate;
dispatch_once(&oncePredicate, ^{
_sharedManager = [[self alloc] init];
});
return _sharedManager;
@ykws
ykws / gist:f31af7c429e14a63d66e2c4bf1978c09
Last active January 20, 2020 16:32
The organization responsible for your new Flutter project
flutter create --org io.github.ykws appname
@ykws
ykws / read_file_without_blocks.rb
Created November 20, 2019 17:21
Access to a file without Ruby Blocks
File.open(ARGV[0], 'r') do |file|
puts file.read
end
@ykws
ykws / read_file_with_blocks.rb
Created November 20, 2019 17:19
Access to a file with Ruby Blocks
File.open(ARGV[0], 'r') {|file| puts file.read}
@ykws
ykws / api-database_operations.php
Created October 27, 2017 01:05
api-database_operations.php
<?php
/**
* [ 概要 ]
* スパイラルのAPIを使ったサンプルプログラムです。
*
* [ サンプルで行う事 ]
* - データベースの検索、レコード更新、レコード削除
*
* UTF8で保存してください。
@ykws
ykws / api-locator2.php
Created October 27, 2017 00:17
api-locator2.php
<?php
/**
* [ サンプルで行う事 ]
* - APIを利用するためのURLを取得する
*
* [サンプルを動かすための準備]
* PHPにcurlライブラリが組み込まれている必要があります。
* 参考:http://www.php.net/manual/ja/intro.curl.php
*/
@ykws
ykws / ActionSheetDatePickerDemoViewController.swift
Last active August 23, 2017 18:32
For ActionSheetDatePicker, set disable before today.
import UIKit
class ActionSheetDemoViewController: UIViewController {
@IBAction func showDatePicker(_ sender: UIButton) {
guard let actionSheetDatePicker = ActionSheetDatePicker.init(title: "Set date", datePickerMode: .date, selectedDate: Date(), doneBlock: {
picker, value, index in
/* doneBlock */
}, cancel: { ActionDateCancelBlock in return }, origin: sender.superview!.superview) else {
return