Skip to content

Instantly share code, notes, and snippets.

View kazz12211's full-sized avatar

Kazuo Tsubaki kazz12211

View GitHub Profile
@kazz12211
kazz12211 / Koshian.swift
Created March 12, 2018 02:28
CoreBluetoothを使ってKoshianのDigital I/Oを操作する例
//
// Koshian.swift
//
// Created by Kazuo Tsubaki on 2018/03/09.
// Copyright © 2018年 Kazuo Tsubaki. All rights reserved.
//
import Foundation
import CoreBluetooth
@kazz12211
kazz12211 / ViewController.swift
Created March 12, 2018 03:46
簡単なコード〜CoreMLとVisionを使ってみる
//
// ViewController.swift
// SimpleCoreMLApp
//
// Created by Kazuo Tsubaki on 2018/03/12.
// Copyright © 2018年 Kazuo Tsubaki. All rights reserved.
//
import UIKit
import AVFoundation
@kazz12211
kazz12211 / DrawRouteInMapView.swift
Created March 23, 2018 00:38
MKMapViewにMKRouteが収まるように表示する方法
private func drawRoute(_ route: MKRoute) {
// 経路を囲む矩形を得る
let mapRect = route.polyline.boundingMapRect
// リージョンに変換
var region = MKCoordinateRegionForMapRect(mapRect)
// リージョンを大きさを少しだけ大きく広げる
let span = MKCoordinateSpanMake(region.span.latitudeDelta * 1.1, region.span.longitudeDelta * 1.1)
region.span = span
// 描画済みのポリラインを削除
mapView.removeOverlays(mapView.overlays)
@kazz12211
kazz12211 / Talker.swift
Created April 10, 2018 06:59
AVSpeechSynthsizeの使用例
/**
* Talker.swift
*
* Author: Kazuo Tsubaki - tsubakicraft.jp
*
* 使用法:
* 1文を読み上げる
* Talker.shared.play("天気は晴れです")
*
* 複数の文を読み上げる
@kazz12211
kazz12211 / WeatherService.swift
Created April 10, 2018 07:16
Swift/iOSでOpenWeatherMapの使用例
/**
* WeatherService.swift
* Author: Kazuo Tsubaki - tsubakicraft.jp
*
* 20分に一回天気を検索する例
*
* 使用例
*
* (WeatherServiceインスタンスを設定して自分をデリゲートに設定)
* let weatherService = WeatherService()
@kazz12211
kazz12211 / monitoring_battery.md
Created May 22, 2018 03:34
バッテリーの状態を監視する方法 (iOS & Swift)

バッテリーの状態を監視する方法 (iOS & Swift)

バッテリーの監視を開始

func startBatteryMonitoring() {
  UIDevice.current.isBatteryMonitoringEnabled = true
  // バッテリー残量の変化を監視
  NotificationCenter.default.addObserver(
 self,
@kazz12211
kazz12211 / OpenWeatherMap.md
Created May 31, 2018 11:22
OpenWeatherMap APIを使用して指定した場所の天気データを取得して表示する例

OpenWeatherMap APIを使用して天気情報を取得する方法

事前にOpenWeatherMapのAPIキーの取得が必要です。

APIキーを所得するページ

import MapKit

 ...
@kazz12211
kazz12211 / TradeshiftEmbeddedApplication.md
Created June 8, 2018 01:36
TradeshiftのOAuth2認証を行うアプリケーションのテンプレート

Tradeshift Embedded Application with OAuth2 authentication

Development environment

  • Eclipse Neon version 4.6.3 with Spring IDE version 3.9.4
  • Java 1.8
  • Spring Boot 1.5.12 or 1.5.13
  • AngularJS 1.6.2
  • Maven
  • etc.
@kazz12211
kazz12211 / lean-typescript-1st-step.md
Created March 7, 2019 03:54
Learning TypeScript - First Step

Learning TypeScript

TypeScriptのインストール

Nodeがインストールされている必要がある。

$ npm install -g typescript
@kazz12211
kazz12211 / ViewController.swift
Created March 13, 2018 07:15
簡単なコード〜CoreMLの物体追跡を試す
//
// ViewController.swift
// ObjectTracking
//
// Created by Kazuo Tsubaki on 2018/03/13.
// Copyright © 2018年 Kazuo Tsubaki. All rights reserved.
//
import UIKit
import AVFoundation