Skip to content

Instantly share code, notes, and snippets.

Toshihiko Arai araemon

View GitHub Profile
View debugMode.kt
if (BuildConfig.DEBUG) {
/* ここにデバッグ時のみ実行したい処理を書く */
}
View admob.kt
val configuration = RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("Test Device Id")).build()
MobileAds.setRequestConfiguration(configuration)
View admob.kt
adView.adListener = object: AdListener() {
override fun onAdFailedToLoad(errorCode : Int) {
// Code to be executed when an ad request fails.
Log.d("Mopi","onAdFailedToLoad(errorCode : Int)" + errorCode)
}
...
}
View isPad.swift
let h = (UIDevice.current.userInterfaceIdiom == .pad) ? 90 : 50
View debug.swift
#if DEBUG
print("デバッグ時のみ実行")
#else
print("リリース時のみ実行")
#endif
View singleton.swift
class Hoge {
static let shared = Hoge()
func doSomething() {
...
}
}
View myColor.swift
extension UIColor {
class var hogeColor: UIColor {
return UIColor(red: 0.9, green: 0.9, blue: 0.9, alpha: 1)
}
}
View radar.py
# -*- coding: utf-8 -*-
# このプログラムはpython2で実行すること
import RPi.GPIO as GPIO
import time
import os
import signal
GPIO.setmode(GPIO.BCM) # 役割ピン番号で命名
TRIG = 20
View hc-sr04.py
# -*- coding: utf-8 -*-
# python2で実行すること
import RPi.GPIO as GPIO
import time
import os
import signal
GPIO.setmode(GPIO.BCM)
TRIG = 20
View servo.py
# -*- coding: utf-8 -*-
# python2で実行すること
import RPi.GPIO as GPIO
import time
import os
import signal
GPIO.setmode(GPIO.BCM)
SIG = 26
You can’t perform that action at this time.