Skip to content

Instantly share code, notes, and snippets.

@melpon
melpon / create_func.hpp
Last active January 2, 2016 08:59
cocos2d-x の CREATE_FUNC を C++ っぽくしてみた
#ifndef CREATE_FUNC_HPP_INCLUDED
#define CREATE_FUNC_HPP_INCLUDED
/*
使い方:
class TestLayer : public cocos2d::Layer {
public:
bool init();
CREATE_FUNC(TestLayer);
@melpon
melpon / not-yakiniku.rst
Last active January 1, 2016 10:09
焼肉以外のお店
@melpon
melpon / with_lambda.hpp
Last active December 31, 2015 16:59
cocos2d-x のコールバックを 2.x で使えるようにしてみた
#ifndef WITH_LAMBDA_INCLUDED
#define WITH_LAMBDA_INCLUDED
#include "cocos2d.h"
template<class Base, class Result, class... Args>
class BindCallback : public Base {
public:
typedef std::function<Result (Args...)> Callback;
typedef Result (cocos2d::CCObject::*Handler)(Args...);
@melpon
melpon / gist:8005579
Created December 17, 2013 14:19
vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 18 2013 02:20:44)
MacOS X (unix) version
Included patches: 1-923
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
Error detected while processing function wandbox#compile_and_dump..wandbox#compile:
line 11:
E605: Exception not caught: Request has failed! Status 500: Internal Server Error
Error detected while processing function wandbox#compile_and_dump:
line 1:
E170: Missing :endfor
Error detected while processing function wandbox#dump_option_list..wandbox#list..wandbox#prettyprint#pp..<SNR>30_option:
line 2:
E716: Key not present in Dictionary: prettyprint_indent
E15: Invalid expression: has_key(b:, name) ? b:[name] : g:[name]
line 3:
E121: Undefined variable: opt
E116: Invalid arguments for function type(opt) == type('') ? eval(opt) : opt
E15: Invalid expression: type(opt) == type('') ? eval(opt) : opt
line 2:
E716: Key not present in Dictionary: prettyprint_width
@melpon
melpon / cc_ptr.hpp
Last active December 31, 2015 12:09
cocos2d 用 intrusive_ptr。適当に書いたので間違ってるところあるかも。
#ifndef CC_PTR_INCLUDED
#define CC_PTR_INCLUDED
/*
static void intrusive_ptr_add_ref(cocos2d::CCObject* p) {
p->retain();
}
static void intrusive_ptr_release(cocos2d::CCObject* p) {
p->release();
}
@melpon
melpon / yakinikutabetaiJP.rst
Last active October 18, 2016 07:37
焼肉食べたいリスト
@melpon
melpon / lunch.rst
Last active December 31, 2015 09:49
ランチに行ってるお気に入りのお店リスト
@melpon
melpon / gist:5242257
Created March 26, 2013 00:53
行動経済学系
- 自分の選択に合理性を見つけようとする
-- A.500円のお金と、B.同価値のボールペンと、C.ちょっとだけ形の違うボールペンだったら、Aが選ばれる
-- B と C のどちらを選んでも合理的な理由が見つけられないから、より理由の見つけやすい A を選ぶ
- 中庸な選択肢を選びたがる
-- 3万円のカメラと6万円のカメラと12万円のカメラがあれば、6万円のカメラを選ぶ
- 選択肢が多いと買わなくなる
-- 店に16,000円の携帯プレーヤーしか無かったら、買う確率が高い
-- 店に16,000円と22,000円の携帯プレーヤーがあったら、買う確率が低い
-- 中庸な選択肢の話はどうなった…?