Skip to content

Instantly share code, notes, and snippets.

View trknhr's full-sized avatar
🎯
Focusing

Teruo Kunihiro trknhr

🎯
Focusing
  • Nulab.inc
  • Fukuoka, Japan
View GitHub Profile
@trknhr
trknhr / backlogOpenAPI.yaml
Created December 20, 2023 05:37
backlogOpenAPI.yaml for ChatGPTs
openapi: 3.0.0
info:
title: Backlog API
version: 1.0.0
servers:
- url: https://xxxx
paths:
/api/v2/issues:
post:
operationId: createIssue
@trknhr
trknhr / dijkstra-priority-queue.py
Created March 23, 2020 14:53
dijkstra's algorithm
import math
import collections
from heapq import *
class Node:
def __init__(self, id):
self.id = id
self.edges = []
def add_route(self, to, cost):
@trknhr
trknhr / sudoku.py
Created February 24, 2020 01:13
数独を解く
import math
def main(board):
helper(board, 0, 0)
return board
def helper(board, row, column):
if len(board[row]) == column:
column = 0
@trknhr
trknhr / EitherSample.scala
Last active June 28, 2017 04:30
Golang LT 2017/06/28
import scalaz._
import scala.util.Random
object EitherSample{
def main(args: Array[String]): Unit ={
println(for {
foo <- doAction("foo")
bar <- doAction("hoo")
} yield{
for{
let nodeList = document.querySelectorAll("div")
[].forEach.call(nodeList, a => console.log(a.innerText));
<script>
class HelloWorld extends HTMLElement{
constructor(){
//always first
super()
const shadow = this.attachShadow({mode:'open'});
shadow.innerHTML =
`
<style>
.content {
export class StateTuple<A, S>{
a: A
s: S
}
export class State<S, A>{
run = null;
constructor(run: (S) => StateTuple<A, S>){
this.run = run;
@trknhr
trknhr / index.html
Created December 1, 2016 15:00
PPAP SCSS
<div class="ppap">
</div>
const STR_LEN = 80
const SUSHI_INTERVAL =10
let cnt = 0;
function sushiDraw(){
const sa = new Array(STR_LEN).fill(' ')
for(let i = 0; i < STR_LEN; i += SUSHI_INTERVAL){
const sushiIndex = sa.length - 1 - (cnt + i) % sa.length
sa.splice(sushiIndex, 1, '🍣')
}
export abstract class Either<T, U>{
abstract isRight(): boolean;
abstract fold<X>(l: (t: T) => X, r: (u: U) => X): X;
isLeft(): boolean{
return !this.isRight();
}
map<B>(f: (U) => B): Either<T, B>{
return this.fold(