Skip to content

Instantly share code, notes, and snippets.

View paosidufygthrj's full-sized avatar

Satoshi paosidufygthrj

View GitHub Profile
@paosidufygthrj
paosidufygthrj / has_hash.cpp
Created December 12, 2015 15:56
hash に対応しているか判定するメタ関数
#include <type_traits>
#include <functional>
using namespace std;
template <typename T, typename Ignore = void>
struct has_hash {
static const bool value = false;
};

GDBでBoostライブラリのPrettyPrinterを導入

導入環境

  • ubuntu 14.04 LTS
  • g++ 4.8.4
  • gdb 7.7
  • python 3.4
  • Boost C++ Libraries 1.59.0
@paosidufygthrj
paosidufygthrj / svn_features.md
Created November 26, 2015 02:33
個人的にSVNで便利に感じた機能

個人的にSVNで便利に感じた機能

はじめに

大したことは書いてないです。
既に知ってるよってひとはスルーして下さい。

目次

  • TortoiseSVNの日本語化
@paosidufygthrj
paosidufygthrj / crossdomain.md
Created November 11, 2015 10:17
クロスドメイン制約

クロスドメイン制約

HTMLでXMLHttpRequestを利用したHTTP通信のクロスドメイン制約の概要についてのまとめです。
Emscripten, Unity(WebGL,WebPlayer),Flashなどで問題の発生が予測されます。

XMLHttpRequest

XMLHttpRequest(以下XHR)はブラウザで既に読み込み済みのページからさらにHTTP通信を行うAPIです。

しかしXHRはセキュリティ上の理由でリクエスト先がHTMLファイルと同じドメインでなければいけないという制約があります。

@paosidufygthrj
paosidufygthrj / gisty.md
Last active August 29, 2015 14:27
gisty 導入メモ

gisty 導入メモ

gisty とは

http://github.com/swdyh/gisty

gist をコマンドラインから利用しやすくするツール。 ファイルの新規投稿や、投稿したファイルをローカルにクローンできる。

導入手順

@paosidufygthrj
paosidufygthrj / switch_1.cpp
Last active August 29, 2015 14:27
[C++]switchの置き換えを考える
// 定数により switch で振る舞いを切り替える
// パラメータが登録されていない定数の場合は assert を実行
#include <iostream>
#include <cassert>
using namespace std;
enum class color {
red,
green,
@paosidufygthrj
paosidufygthrj / set_included_variant2.cpp
Last active August 29, 2015 14:27
[C++]variant 型に格納された値を異なる variant 型に格納できる場合はコピーする
#include <boost/variant.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/find.hpp>
#include <type_traits>
#include <iostream>
using namespace boost;
using namespace boost::mpl;
// variant が格納できる型に T 型が含まれているか返すメタ関数
@paosidufygthrj
paosidufygthrj / istreambuf_sample.cpp
Last active August 29, 2015 14:26
[C++]std::istream の残りの文字列から std::string を作成
#include <iostream>
#include <sstream>
using namespace std;
int main() {
istringstream is("01234");
is.ignore(3);
istreambuf_iterator<char> begin(is);
@paosidufygthrj
paosidufygthrj / value_getter.cpp
Created July 30, 2015 10:43
[C++]T::value か規定値を返すメタ関数
#include <iostream>
#include <type_traits>
using namespace std;
template <typename T, typename Ignore = void>
struct value_getter {
static const int value = 0;
};