Skip to content

Instantly share code, notes, and snippets.

View araiyusuke's full-sized avatar

荒井佑介 araiyusuke

View GitHub Profile
@araiyusuke
araiyusuke / PhotoView.swift
Created August 9, 2022 02:04 — forked from ricardo0100/PhotoView.swift
Photo View with zoom and edges control in SwiftUI
import SwiftUI
struct PhotoView: View {
@State var scale: CGFloat = 1
@State var scaleAnchor: UnitPoint = .center
@State var lastScale: CGFloat = 1
@State var offset: CGSize = .zero
@State var lastOffset: CGSize = .zero
@State var debug = ""
@araiyusuke
araiyusuke / test.py
Last active May 17, 2021 01:47
test
import json
import datetime
import decimal
import boto3
from boto3.dynamodb.conditions import Key, Attr
print('Loading function')
dynamodb = boto3.resource('dynamodb')
def lambda_handler(event, context):
# npm node.js install
RUN apt-get -y update
RUN apt-get install -y \
curl \
gnupg
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt-get install -y nodejs
RUN npm install npm@latest -g
@araiyusuke
araiyusuke / 0_reuse_code.js
Created February 8, 2017 06:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
phpinfo();
?>
@araiyusuke
araiyusuke / ViewController.swift
Last active September 24, 2016 04:21
Swift3で音声ファイルを再生
import AVFoundation
import UIKit
class ViewController: UIViewController {
var audioPlayer = AVAudioPlayer()
override func viewDidLoad() {
super.viewDidLoad()
@araiyusuke
araiyusuke / gist:8a45ba9e484e817e6ddf
Created July 20, 2015 04:15
非同期で住所を取得
addressEdit = (EditText)findViewById(R.id.address);
final EditText addressEdit = (EditText)findViewById(R.id.address);
new Thread(){
@Override
public void run(){
final String address = MyLib.getAddress(location, getApplicationContext());
new Handler(Looper.getMainLooper()).post(new Runnable(){
@Override
@araiyusuke
araiyusuke / gist:22ee9b6251c36133e5bd
Last active August 29, 2015 14:24
通知バーを作成して、そこからアクティビティ起動
Intent i = new Intent();
i.setClassName("sensor.sports.co.jp.notification", "sensor.sports.co.jp.notification.MainActivity");
PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
Notification notification = new NotificationCompat.Builder(this)
.setContentTitle("タイトル")
.setContentText("現在、走行距離を測定してます。")
.setSmallIcon(R.drawable.notification_template_icon_bg)
.setContentIntent(pi)
.build();
public double getDistance(LatLng latlng1, LatLng latlng2) {
float[] results = new float[3];
Location.distanceBetween(
latlng1.latitude,
latlng1.longitude,
latlng2.latitude,
latlng2.longitude,
results);
if(results != null && results.length > 0) {