Skip to content

Instantly share code, notes, and snippets.

View nariakiiwatani's full-sized avatar

nariakiiwatani nariakiiwatani

View GitHub Profile
#!/bin/sh
for i in `ls -d \`dirname $0\`/*.app`
do
xattr -cr $i
done
@nariakiiwatani
nariakiiwatani / GAS_roulette
Created April 7, 2021 14:59
Random roulette app for GoogleSpreadsheet(GAS). Deploy and HTTP GET!
function doGet(e) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName("フォームの回答 1");
var range = sheet.getRange("B2:B");
var values = range.getValues();
values = values.filter(String).map(v=>v[0]);
// console.info(values);
var value = values.length > 0 ? values[Math.floor(Math.random()*values.length)] : "まだ投稿されていない";
// console.info(value);
template<typename T>
class DelayBank {
public:
void add(const T &t, float wait_time) {
waiter_.push_back({t,wait_time});
}
void update() {
using namespace std;
ended_.clear();
float time = ofGetLastFrameTime();
int x, y, index, posX[10], posY[10];
// あとでiという変数を使うので、indexに改名しました。
// iのままでも同じ動きをしますが、わかりにくくなるといけないので。
//--------------------------------------------------------------
void ofApp::setup() {
ofSetWindowShape(600, 400);
ofSetFrameRate(30);
ofSetBackgroundColor(255, 255, 255);
(defvar jack [-38 -67.1875])
(defvar red0 [-31 -161.1875])
(defvar red1 [-119 -171.1875])
(defvar red2 [33 -116.1875])
(defvar blue0 [-115 -78.1875])
(defvar blue1 [84 50.8125])
(defvar blue2 [22 -26.1875])
(defvar blue3 [-81 -10.1875])
(defvar size 10)
(def red [red0 red1 red2])
// DebugTextEditor.tsx
// Copyright 2020 nariakiiwatani
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WI
// useStackRef.ts
// Copyright 2020 nariakiiwatani
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH
import { useCallback } from 'react'
import * as THREE from "three"
import { useSpring } from "react-spring"
export interface OrbitParam {
position: THREE.Vector3,
target: THREE.Vector3,
up: THREE.Vector3,
fov: number,
zoom: number
// Copyright 2020 nariakiiwatani
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
(defn clamp
{:inverse (fn [{:return ret :params [v min max]}]
[ret min max])}
[v min max]
(if (< v min) min
(if (> v max) max
v))
)
(defvar v 142.8125)
(style (stroke "salmon" 5)