Skip to content

Instantly share code, notes, and snippets.

View hsylife's full-sized avatar

Yuta Hoshino hsylife

View GitHub Profile
@hsylife
hsylife / file0.swift
Last active December 16, 2018 12:57
文字につける影の比較 ref: https://qiita.com/hsylife/items/8c04bfcec6a640b38db7
import UIKit
@IBDesignable class ShadowAttributeSettableLabel : UILabel {
@IBInspectable var shadowColorForCustom: UIColor = .clear
@IBInspectable var shadowOffsetForCustom: CGSize = .zero
@IBInspectable var shadowRadiusForCustom: CGFloat = 0.0
override func layoutSubviews() {
super.layoutSubviews()
@hsylife
hsylife / file0.sh
Last active September 4, 2018 06:17
ffmpegでmovからmp4に変換する ref: https://qiita.com/hsylife/items/27732fad752cc9433100
$ brew reinstall ffmpeg --with-fdk-aac --with-freetype --with-libass --with-libvpx --with-sdl2 --with-x265
@hsylife
hsylife / file0.txt
Last active August 12, 2018 10:32
簡単にMacから全てのディスクを取り外す ref: https://qiita.com/hsylife/items/063722ec489d8e407426
on run {input, parameters}
tell the application "Finder" to eject (every disk whose ejectable is true)
end run
- (void)viewDidLoad {
[super viewDidLoad];
// Set app volume to be half of the current device volume.
GADMobileAds.applicationVolume = 0.5;
...
}
@hsylife
hsylife / after
Last active March 19, 2017 14:20
RealmファイルをwatchOSにfileTransferしたときの実機で生じるエラーと解決方法 ref: http://qiita.com/hsylife/items/7dc70b52e34dd941c9e4
// When the file was received
func session(_ session: WCSession, didReceive file: WCSessionFile) {
//set the recieved file to default Realm file
var config = Realm.Configuration()
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let documentsDirectory = paths[0]
let realmURL = documentsDirectory.appendingPathComponent("data.realm")
if FileManager.default.fileExists(atPath: realmURL.path){
try! FileManager.default.removeItem(at: realmURL)
@hsylife
hsylife / Eureka1.7.0
Last active March 17, 2017 10:18
EurekaとSwift 2.3→3.0の書き換え。画像選択カスタムローの例 ref: http://qiita.com/hsylife/items/4f6fb461bfae86b53475
public class ImageSelectorViewController<T:Equatable> : _ImageSelectorViewController<T, ListCheckRow<T>> {
override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
convenience public init(_ callback: (UIViewController) -> ()){
self.init(nibName: nil, bundle: nil)
completionCallback = callback
}
@hsylife
hsylife / ImageSelectorViewController.swift
Last active March 10, 2017 12:29
EurekaをSwift 2.3→3.0用にアップデートして遭遇したエラー例と解決方法 その1 ref: http://qiita.com/hsylife/items/e612221c28cc367525df
open class ImageSelectorViewController<T:Equatable> : _ImageSelectorViewController<ListCheckRow<T>> {
}
@hsylife
hsylife / file0.txt
Last active March 9, 2017 13:58
Ethereumのプライベートネットワークで送金する体験 ref: http://qiita.com/hsylife/items/5668dca6cda778efe6bd
> miner.setEtherbase(eth.accounts[0])
> miner.start()
@hsylife
hsylife / file0.txt
Created March 7, 2017 19:24
Ethereumプライベートネットワークのアカウント作成まで ref: http://qiita.com/hsylife/items/4939a35a863ce38c7192
$ mkdir ${HOME}/sample_eth_pn
@hsylife
hsylife / Field.swift
Last active November 25, 2016 12:57
How to exchange Realm data between watchOS and iOS ref: http://qiita.com/hsylife/items/26629e65bf66d79cd311
import RealmSwift
public class Field: Object {
public dynamic var text: String?
}