Skip to content

Instantly share code, notes, and snippets.

nanto_vi, TOYAMA Nao nanto

Block or report user

Report or block nanto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nanto
nanto / Emittable.ts
Last active Mar 23, 2017
An emitter (observer pattern) implementation to mixin, written in TypeScript.
View Emittable.ts
// An emitter implementation to mixin.
//
// This file is in the public domain.
//
// Usage:
//
// import Emittable from "...";
//
// class MyEmitter implements Emittable {
// on = Emittable.on;
@nanto
nanto / js-unicode-prop-pattern.pl
Created Jun 5, 2016
Convert Perl regexp `\p{...}` to JS regexp
View js-unicode-prop-pattern.pl
# Usage: $0 <property>
#
# Print a JavaScript regular expression pattern
# corresponding to a Perl regular expression pattern `\p{property}`.
#
# See `perldoc perluniprops` for values that can be specified as <property>.
#
# Author: nanto_vi
# License: Public Domain
@nanto
nanto / es6-draft-memo.txt
Last active Aug 29, 2015
ECMAScript 6 草案を斜め読みしていくメモ
View es6-draft-memo.txt
https://people.mozilla.org/~jorendorff/es6-draft.html を参照する。
4.3.25
Symbol value が ES 6 で登場。
5.1.5
パラメータ化がたくさん。
@nanto
nanto / content.tt
Created Nov 12, 2014
Text::Xslate::TTerse の undocumented な動作
View content.tt
Out of WRAPPER
[%- WRAPPER 'wrapper.tt' WITH arg1 = var, arg2 = 'literal' -%]
arg2: [% arg2 %]
[%- END -%]
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>host of cloned 'a' element</title>
</head>
<body>
<script>
var a = document.createElement('a');
@nanto
nanto / classify.js
Created Aug 17, 2014
Emulate 'class' of class-based object-oriented languages.
View classify.js
// classify -- emulate 'class' of class-based object-oriented languages.
//
// This file is in the public domain.
//
// classify(constructor, members)
// classify(constructor, superConstructor)
// classify(constructor, superConstructor, members)
//
// If you specify 'superConstructor', you can call 'callSuper' method in 'constructor'.
//
@nanto
nanto / plack-middleware-env.pl
Created Feb 18, 2014
Run legacy applications which depend on environment variables.
View plack-middleware-env.pl
package Plack::Middleware::ENV;
use strict;
use warnings;
use parent qw(Plack::Middleware);
sub call {
my ($self, $env) = @_;
my @fields = grep { m/^(?:HTTP.*|REMOTE_ADDR)$/ } keys %$env;
local @ENV{@fields} = @$env{@fields};
return $self->app->($env);
View golang-tour-35.go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
ret := make([][]uint8, dy)
for y := range(ret) {
ret[y] = make([]uint8, dx)
for x := range(ret[y]) {
if x % 8 == 0 || y % 8 == 0 {
@nanto
nanto / kyoto-restaurants.txt
Created Jul 22, 2013
京都の四条、御池辺りのお店
View kyoto-restaurants.txt
太郎屋
京のおばんざい
http://tabelog.com/kyoto/A2602/A260201/26000639/
醪音
「英勲」の酒蔵の直営店
http://tabelog.com/kyoto/A2602/A260201/26017974/
ななたに
地鶏ローストチキン
@nanto
nanto / app.psgi
Created Mar 5, 2013
$SIG{__DIE__} の設定如何で Text::Xslate の投げる例外が変化するかもしれないというメモ
View app.psgi
use Our::App;
use Try::Tiny;
use Devel::StackTrace::WithLexicals;
builder {
enable sub {
my $app = shift;
sub {
my $trace;
local $SIG{__DIE__} = sub {
You can’t perform that action at this time.