Skip to content

Instantly share code, notes, and snippets.

View kurone-kito's full-sized avatar
🐱
にゃーん

Kuroné Kito (黒音キト) kurone-kito

🐱
にゃーん
View GitHub Profile
@kurone-kito
kurone-kito / onBackHome.js
Created January 20, 2019 09:39
Script for AWS Lambda: To judge if at night and to pass the result to the Webhooks of IFTTT.
const https = require('https');
const ifttt = event => `https://maker.ifttt.com/trigger/${event}/with/key/${process.env.IFTTT_WEBHOOK_KEY}`;
exports.handler = async (event) => {
const time = new Date();
const valid = time.getHours() >= 18;
const eventId = valid ? 'night' : 'other';
await new Promise(r => https.get(ifttt(eventId), r));
const response = { statusCode: 200, body: eventId };
@kurone-kito
kurone-kito / RotateMoveBehaviour.cs
Last active January 20, 2019 09:48
A behavior script for Unity: for moving an object in a rect shape by turning it at a right angle using a quaternion when outed a certain range.
using UnityEngine;
public class CubeBehavior : MonoBehaviour
{
const float threshold = 1f;
private readonly Quaternion quaternion = Quaternion.AngleAxis(90, Vector3.down);
public Vector3 direction = Vector3.forward * 0.1f;
// Update is called once per frame