This file contains 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
#!/usr/bin/env ruby | |
require 'rake' | |
module FileWatchHandler | |
def execute | |
EM.stop_event_loop | |
end | |
alias :file_modified :execute | |
alias :file_moved :execute |
This file contains 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-syntax b | |
(syntax-rules () | |
((b) 1))) | |
(define-syntax a | |
(syntax-rules () | |
((a) (b)))) | |
(define-syntax b | |
(syntax-rules () |
This file contains 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-syntax forever | |
(syntax-rules () | |
((_) (forever)))) | |
; (forever) ; don't return ... | |
(define-syntax a | |
(syntax-rules () | |
((_) (if #t 1 (forever))))) |
This file contains 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-syntax l | |
(syntax-rules () | |
((_ P Q ...) (lambda (P) Q ...)))) | |
(define c 1) | |
(define-syntax macro | |
(syntax-rules () | |
((_ P) ((l c (list c P)) c)))) |
This file contains 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-syntax macro | |
(syntax-rules () | |
((_ (A ...) (B ...)) (list '(A B) ...)))) | |
(macro (1 2 3) (4 5)) ;; => ((1 4) (2 5)) |
This file contains 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 resetcont #f) | |
(define-syntax reset | |
(syntax-rules () | |
((_ F ...) | |
(let/cc c | |
(set! resetcont c) | |
(let ((r (begin F ...))) | |
(resetcont r)))))) |
This file contains 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
// 四則演算の構文解析 | |
// http://algorithms.blog55.fc2.com/blog-entry-154.html | |
// http://www.prefield.com/algorithm/string/parser.html | |
// を見ながら書いてみた. | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
typedef pair<int, int> result; | |
#define value first |
This file contains 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 <Cocoa/Cocoa.h> | |
@interface MyController : NSObject | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; | |
@end | |
@implementation MyController | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSUInteger winStyle = (NSTitledWindowMask | NSClosableWindowMask |
This file contains 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 <Carbon/Carbon.h> | |
int main(void) { | |
CTFontCollectionRef collection = CTFontCollectionCreateFromAvailableFonts(NULL); | |
if (collection) { | |
CFArrayRef array = CTFontCollectionCreateMatchingFontDescriptors(collection); | |
CFIndex arrayNum = CFArrayGetCount(array); | |
for (CFIndex i = 0; i < arrayNum; i++) { | |
CFStringRef attribute = CTFontDescriptorCopyAttribute( |
This file contains 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
fib := method(n, | |
if (n == 1 or n == 2, return 1) | |
p1 := 1 | |
p2 := 1 | |
for (i, 3, n, | |
temp := p1 | |
p1 := p1 + p2 | |
p2 := temp) | |
return p1 |