This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "Win32API" | |
class FilesystemWatcher | |
FILE_NOTIFY_CHANGE_FILE_NAME = 0x00000001 | |
FILE_NOTIFY_CHANGE_DIR_NAME = 0x00000002 | |
FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x00000004 | |
FILE_NOTIFY_CHANGE_SIZE = 0x00000008 | |
FILE_NOTIFY_CHANGE_LAST_WRITE = 0x00000010 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DEF_CLASS(NAME, SUPERCLASS) \ | |
NAME : SUPERCLASS \ | |
@end \ | |
@implementation NAME | |
@interface DEF_CLASS(MyInternalClass, NSObject) | |
{ | |
int m_hoge; | |
} | |
- (void)run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# ASCIIのIDのリストから、与えられた文字列がリストにあるかどうかをチェックする関数のコードを生成します。 | |
# | |
# 例: | |
# ---- hoge.txt ---- | |
# HOGE 1 | |
# HIGE 2 | |
# HOGA 3 | |
# | |
# ------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
// QzCacheMapにキャッシュさせる為には、これを継承させる | |
@interface QzCacheEntry : NSObject | |
@end | |
@interface QzCacheMap : NSObject | |
- (id)initWithCapacity:(size_t)capacity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function id($msg, $val) | |
{ | |
echo "call:$msg", PHP_EOL; | |
return $val; | |
} | |
$ret = | |
id("A", true) ? id("A'", "a") : | |
id("B", false) ? id("B'", "b") : id("C", "c") ; | |
echo $ret, PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSRegularExpression *const rx = | |
// 内側の「.*?」を「.*」にするとフリーズ | |
[[NSRegularExpression alloc] initWithPattern:@"((.*?)*?)X" | |
options:0 | |
error:nil]; | |
[rx firstMatchInString:@"1a" | |
options:0 | |
range:NSMakeRange(1, 1)]; // ここで落ちる(´;ω;`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// リスト構造 | |
template<int N, typename Cdr> struct cons {}; | |
struct nil {}; | |
// リストから特定の要素を除去 | |
template<int N, typename List> struct exclude { typedef nil val; }; | |
template<int N, typename Cdr> struct exclude<N,cons<N,Cdr>> | |
{ | |
typedef typename exclude<N,Cdr>::val val; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// こんな感じのがあった時の話.. | |
extern void call_later(void(*fun)(void*), void *arg); | |
#include <stdio.h> | |
#include <tuple> | |
template<typename Fun> void run(void *arg) | |
{ | |
(*(Fun*) arg)(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) | |
#include <iostream> | |
#include <memory> | |
struct hoge_0 | |
{ | |
virtual void call() = 0; | |
}; | |
template<typename Func> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <functional> | |
#include <utility> | |
#include <iostream> | |
namespace | |
{ | |
struct wildcard { wildcard(...); }; | |
template<typename ...Args> inline auto invoke(wildcard, Args &&...args) -> wildcard; |