Skip to content

Instantly share code, notes, and snippets.

View tai2's full-sized avatar
🐢

Taiju Muto tai2

🐢
View GitHub Profile
@tai2
tai2 / jquery-selectmenu.js
Last active September 11, 2021 11:30
jquery ui select menu vue component
Vue.component('jquery-selectmenu', {
props: ['value'],
template: `<select><slot /></select>`,
mounted: function() {
const emit = value => this.$emit('input', value);
$(this.$el).selectmenu({
change: function(event, data) {
emit(data.item.value);
}
});
@tai2
tai2 / gflw_template.c
Created June 21, 2017 15:50
GLFW template
// gcc hello_opengl.c -o hello_opengl -lglfw -framework OpenGL
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
@tai2
tai2 / plan.md
Last active June 12, 2017 08:13
Rails5.1でReact Todo MVC

Rails5.1でReact Todo MVC

読者はwebpackerのREADMEを読んでないと仮定。

入れるもの

  • redux
  • flowtype
  • eslint
  • reducerのテスト
#!/usr/bin/env python3
# No.2260 所得税の税率 https://www.nta.go.jp/taxanswer/shotoku/2260.htm
# [平成28年4月1日現在法令等]に基づく
#
# 小規模企業法令 http://law.e-gov.go.jp/htmldata/S40/S40SE185.html
#
# 前提:
# - 簡単のため、納付月数は1年単位とする(納付月数=勤続年数 * 12)
# - 掛金固定
# - 所得固定
import os
import sys
import tensorflow as tf
import skimage.io as io
import skimage.morphology
import numpy as np
#sys.path.append('tf-image-segmentation')
sys.path.append('tf-image-segmentation-tf1.0')
sys.path.append('models/slim')
ws = x[:y].map do |y|
y[:z].map do |z|
z[:w]
end
end
ws.flatten.uniq {|w| w[:key]}
ws = {}
x[:y].each do |_, y|
y[:z].each do |_, z|
z[:w].each do |_, w|
ws[w[:key]] = w
end
end
end
ws.values
ws = x[:y].map do |y|
y[:z].map do |z|
z[:w]
end
end
ws = ws.flatten
.group_by {|w| w[:key]}
.map {|k, v| v.first}
@tai2
tai2 / shaker.cpp
Created April 27, 2017 03:14
shaker sort
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctime>
template<typename BidirectionalIterator>
void bubble_sort( BidirectionalIterator first, BidirectionalIterator last )
{
if( first == last ) return;