Skip to content

Instantly share code, notes, and snippets.

View castaneai's full-sized avatar
🥳
Watching anime

castaneai castaneai

🥳
Watching anime
View GitHub Profile
@castaneai
castaneai / split_test.c
Created May 21, 2014 13:14
split関数のテスト
#include <stdio.h>
#include <memory.h>
#include <string.h>
char** split(char* originalString, int stringNum)
{
int i;
char** stringArray;
char* tp;
@castaneai
castaneai / easeljs_box.js
Created May 22, 2014 15:23
EaselJSで衝突判定,落下運動
window.onload = function () {
// 初期設定
var canvas = document.createElement("canvas");
canvas.width = 500;
canvas.height = 250;
document.body.appendChild(canvas);
var stage = new createjs.Stage(canvas);
// プレイヤー
var box = new createjs.Shape();
@castaneai
castaneai / add_schedule.c
Last active August 29, 2015 14:02
add_schedule.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct schedule{
int year;
int month;
int day;
int hour;
int minute;
@castaneai
castaneai / implicit-type-parameter.scala
Last active August 29, 2015 14:03
implicitを用いたパケットを扱うクラスを型で自動分岐する例 もっと簡潔に書けそうで思いつかない.
trait Packet
class ItemPacket extends Packet
class QuestPacket extends Packet
object PacketHandler {
trait PacketHandler[T <: Packet] {
def handle(packet: T)
}
implicit object ItemPacketHandler extends PacketHandler[ItemPacket] {
@castaneai
castaneai / std_function_typedef.cpp
Created July 8, 2014 13:14
typedef std function
#include <iostream>
#include <functional>
typedef std::function<void()> ThreadFunc;
int main(){
ThreadFunc a = []{};
a();
return 0;
}
@castaneai
castaneai / asyncio_accept.py
Created July 24, 2014 12:49
requires python >= 3.4
import asyncio
def on_accept(r, w):
print("new client accepted.")
print(r, w)
if __name__ == "__main__":
future = asyncio.start_server(on_accept, host="127.0.0.1", port=5555)
asyncio.async(future)
# -*- coding: utf-8 -*-
import asyncio
# coroutineデコレータをつけるだけでコルーチンになる
@asyncio.coroutine
def cor():
asyncio.sleep(1)
return "cor_result"
@castaneai
castaneai / gcc_optimization.md
Last active August 29, 2015 14:04
gccの最適化を実験してみた

gccの最適化を実験してみた

使われてない変数はgccの最適化で消えるのか?

  • void.c
int main(void) {
 return 0;
@castaneai
castaneai / 00_mvvm.md
Last active October 29, 2020 15:22
[C#, WPF] MVVMで簡単なアプリを作成

[C#, WPF] MVVMで簡単なアプリを作成

実行画面

実行画面

設計図

設計図

int[] array = new int[]
{
1,
7,
16,
11,
14,
19,
20,
18