Skip to content

Instantly share code, notes, and snippets.

View meki's full-sized avatar
🏠
Working from home

Satoshi Sashida meki

🏠
Working from home
View GitHub Profile
@meki
meki / main.dart
Created October 17, 2021 06:19
BLoK example
// forked from https://qiita.com/kabochapo/items/8738223894fb74f952d3
import 'dart:async';
void main() {
final data = {'イチゴ': '苺', 'イチジク': '無花果', 'リンゴ': '林檎'};
final controller = StreamController<String>();
controller.sink.add('イチゴ');
@meki
meki / List2D.cs
Created November 12, 2015 17:34
2次元の List (foreach, LINQ 使用可) ref: http://qiita.com/_meki/items/306cf7c99c04b65431f7
using System.Linq;
namespace System.Collections.Generic
{
public class List2D<T> : IEnumerable<List2dIndexer<T>> where T : new()
{
public List2D(int w, int h)
{
mWidth = w;
mHeight = h;
@meki
meki / file0.cpp
Created October 9, 2015 16:43
文字列を指定した区切り文字列で分割する関数 ref: http://qiita.com/_meki/items/4328c98964ea33b0db0d
#include <string>
template <typename List>
void split(const std::string& s, const std::string& delim, List& result)
{
result.clear();
using string = std::string;
string::size_type pos = 0;
@meki
meki / Main.cpp
Last active August 29, 2015 14:24
#include <iostream>
#include "immutable.hpp"
#include <vector>
#include <list>
#include <string>
#include <cassert>
using namespace std;
int main(void){
@meki
meki / InvertedSphere.cs
Created June 6, 2015 11:36
Cube や Sphere の内壁で衝突判定したい ref: http://qiita.com/_meki/items/b5c12eeee125d868e92d
using UnityEngine;
using UnityEditor;
public class InvertedSphere : EditorWindow {
private string st = "1.0";
[MenuItem("GameObject/Create Other/Inverted Sphere...")]
public static void ShowWindow() {
EditorWindow.GetWindow(typeof(InvertedSphere));
}
@meki
meki / Image2D.h
Created May 6, 2015 08:02
Scala で pgm 形式画像を作って保存する ref: http://qiita.com/_meki/items/e718082651fa275b9857
#include <sstream>
#include <vector>
#include <random>
#include <cstdio>
// 2次元画像クラス
class Image2D {
public:
// Int に Pixel という別名をつける
@meki
meki / Converter.h
Last active August 29, 2015 14:19
Byte <--> Ushort, Short Converter
struct Converter
{
static unsigned short UShort(unsigned char b1, unsigned char b2)
{
return (unsigned short)( (0xff00 & (b2 << 8)) | (0x00ff & (b1 << 0)) );
}
static short Short(unsigned char b1, unsigned char b2)
{
@meki
meki / FixedQueue.h
Last active August 29, 2015 14:19
固定長キュークラス
#include <deque>
/**
* 固定長キュークラス
*/
template <typename T>
class FixedQueue
{
public:
@meki
meki / CurryImpl.h
Created March 28, 2015 11:21
C++ でカリー化関数を書いてみる(2変数限定) ref: http://qiita.com/_meki/items/742ce9788f03cee51070
/** A -> (B -> C) 型の関数オブジェクト */
template <typename A, typename B, typename C>
struct CurryImpl {
// コンストラクタでオリジナルの関数をキャプチャ
CurryImpl(function<C(A, B)>& f) : mFunc(f) {}
/** B -> C 型の関数オブジェクトをリターンする */
function< C(B) > operator () (A& a) {
return CurryImpl2(mFunc, a);
@meki
meki / file0.cs
Created January 3, 2015 05:08
C# プログラムからワード文書を作成編集する方法 ref: http://qiita.com/_meki/items/ef064d8861bda4363562
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Word;
using Word = Microsoft.Office.Interop.Word;
namespace WordSample
{