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 | |
| def fact(n); (n==1)? 1: n*fact(n-1); end; | |
| class Fixnum; def !(); fact(self); end; end | |
| print 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
| // semicolonless Java | |
| public class A | |
| { | |
| public static void main(String[] args) { | |
| return\u003b | |
| } | |
| } |
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
| // clang -Wall -x objective-c -std=c99 -fobjc-arc -framework Foundation -o a.out a.m | |
| #import <objc/objc.h> | |
| #import <objc/objc-runtime.h> | |
| #import <CoreFoundation/CoreFoundation.h> | |
| #import <Foundation/Foundation.h> | |
| void foo(int a) | |
| { | |
| switch (a) | |
| { |
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 -*- | |
| path = File.expand_path File.join File.dirname(__FILE__), '..', 'lib' | |
| $LOAD_PATH.unshift path unless $LOAD_PATH.include? path |
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
| (defun new-working-buffer () | |
| (interactive) | |
| (find-file (concat | |
| (format-time-string "~/%Y-%m%d-%H%M%S.") | |
| system-name))) |
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
| // g++ -std=c++11 RiverCrossing.cpp | |
| #include <iostream> | |
| #include <queue> | |
| #include <vector> | |
| #include <array> | |
| #include <algorithm> | |
| using namespace std; |
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
| from math import pi, sqrt, acos, asin, sin, cos | |
| for n in range(0, 360+1, 10): | |
| x = cos(pi * n / 180) | |
| y = sin(pi * n / 180) | |
| r = sqrt(x ** 2 + y ** 2) | |
| th_cos = 180 * acos(x / r) / pi | |
| th_sin = asin(y / r) | |
| if th_sin < 0: | |
| th_cos = 360 - th_cos |
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
| from math import pi, sqrt, acos, asin | |
| def vsub(a, b): | |
| return (a[0] - b[0], a[1] - b[1]) | |
| def hit(a, b, c, p): | |
| ab = vsub(b, a) | |
| bp = vsub(p, b) | |
| bc = vsub(c, b) | |
| cp = vsub(p, c) |
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 -*- | |
| # http://www.checkio.org/mission/brackets/ | |
| # 普通こうでは!? | |
| from itertools import dropwhile | |
| pairs = '{} [] ()'.split() | |
| def parse_term(s): | |
| t = ''.join(dropwhile(str.isdigit, s)) |
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
| (defun or/l (args) | |
| (let ((r nil)) | |
| (while (and args (null r)) | |
| (setq r (or r (car args))) | |
| (setq args (cdr args))) | |
| r)) |