コントローラクラスは、得になにも継承する必要はない。が、各プロジェクトで親になるクラスを作っておいたほうが便利。
基本的な見た目は 1 と変わらない。
public class EntryController {
@GET("/entry/detail")
public WebResponse index(@Param("id") long id) {
use v6; | |
sub MAIN($port=5000) { | |
react { | |
whenever IO::Socket::Async.listen('127.0.0.1', $port) -> $conn { | |
run 'ls'; # process exits at here. | |
await $conn.print("yo"); | |
$conn.close(); | |
} | |
} |
use strict; | |
use warnings; | |
use utf8; | |
use 5.010000; | |
use IO::Socket::INET; | |
my $port = 3000; | |
my $n = 1000; |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use 5.010000; | |
use autodie; | |
use Term::ANSIColor; | |
use Getopt::Long; | |
use Time::HiRes qw/sleep/; | |
use Pod::Usage; |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use 5.010000; | |
use autodie; | |
use File::Find; | |
use Getopt::Long; | |
use File::Temp; |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
public class Hoge { | |
public static void main(String[] args) throws IOException { | |
Files.readAllLines(Paths.get(args[0])).stream() | |
.flatMap(line -> Arrays.stream(line.split("\\W+"))) |
#!/bin/sh | |
set -x | |
set -e | |
WORK=$HOME/.rakudo-build/ | |
PREFIX=$HOME/perl6 | |
mkdir -p $PREFIX | |
mkdir -p $WORK | |
rm -rf $WORK/rakudo |
(function () { | |
// public domain. buggy. | |
"use strict" | |
var elems = document.getElementsByClassName("fillinform"); | |
var query = parseQuery(); | |
for (var i = 0, l = elems.length; i < l; i++) { | |
var it = elems[i]; | |
Object.keys(query).forEach(function (key) { | |
var input = it.querySelector("input[name=" + key + "]"); | |
if (input.type == "checkbox") { |
import java.time.LocalDateTime; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.util.Locale; | |
public class DateTimeFormatterSample { | |
public static void main(String[] args) { | |
String[][] patterns = new String[][]{ | |
new String[]{"G", "appendText(ChronoField.ERA,"}, |
use strict; | |
use warnings; | |
use Test::More; | |
ok(!eval { require Moose; 1; }, 'no Moose'); | |
ok(!eval { require DateTime; 1; }, 'no DateTime'); | |
ok(!eval { require Devel::StackTrace::WithLexicals; 1; }, 'no Devel::StackTrace::WithLexicals'); | |
done_testing; |