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
@on('POST', '/foobar') | |
def do_post(self): | |
do_something1() | |
do_something2() | |
## 残念ながら Python ではブロックをスキップする機能が | |
## ないのでこれは使えない | |
with invoke('new_cool_feature_name'): | |
old_feature1() | |
old_feature2() | |
## なので、decoratorをhiger order functionの |
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 -*- | |
require 'sinatra/base' | |
require 'rack' | |
require 'rack/protection' | |
require 'rack/protection/frame_options' | |
require 'rack/protection/http_origin' | |
require 'rack/protection/ip_spoofing' | |
require 'rack/protection/json_csrf' | |
require 'rack/protection/path_traversal' |
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 -*- | |
### | |
### Benchmark: create a list object padding by zero | |
### | |
from benchmarker import Benchmarker | |
try: | |
xrange |
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 -*- | |
### | |
### Benchmark: http://cocodrips.hateblo.jp/entry/2015/10/11/114212#問題2 | |
### | |
from benchmarker import Benchmarker | |
try: | |
xrange |
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
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>15 Puzzle</title> | |
<link rel="stylesheet" type="text/css" href="main.css" /> | |
</head> | |
<body> | |
<div id="main-content"> | |
<table id="puzzle"> | |
<tbody> |
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 */ | |
#main-content { | |
padding-top: 50px; | |
} | |
#puzzle { | |
border-collapse: collapse; | |
border: solid 1px #ccc; | |
font-size: x-large; |
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 | |
/// | |
/// for 15puzzle | |
/// | |
var Util = { | |
init: function() { |
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
class IO | |
## | |
## Easy-to-use nonblocking read() | |
## | |
## * returns non-empty string when data exists | |
## * returns empty string when data not exist | |
## * returns nil when EOF | |
## | |
def read_nonblocking(size) |
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 <iostream> | |
int fn() { | |
int x; | |
return x; // returns uninitialized local variable | |
} | |
int main(int argc, char*args[]) { | |
//std::cout << "Hello\n"; | |
std::cout << fn() << "\n"; |
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 <iostream> | |
#include <string> | |
void fn() { | |
int x; | |
std::string s; | |
std::cout << x; // warning: variable 'x' is uninitialized when used here | |
std::cout << s; // (no warnings due to default constructor) | |
std::cout << "\n"; | |
} |