Skip to content

Instantly share code, notes, and snippets.

View kazurof's full-sized avatar
🏠
Working from home

Kazuro Fukuhara kazurof

🏠
Working from home
View GitHub Profile
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
public class ECJProblem {
private static final String nantoka = "kantoka";
public String doSomething(@TestAnnotation(nantoka) String nantoka) {
return "doushita";
}
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
/**
* 添字人数になるように会社を選んだ組み合わせの時の総コスト。
* {@link #NOT_ASSIGNED} の場合はそのような組み合わせは存在しない。
*/
static int[] costByNumOfMember;
import java.util.List;
import java.util.OptionalInt;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Main {
/**
* 全ての会社を選択した場合の人数
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class Main {
@kazurof
kazurof / POHLite-kirishima-awk.java
Last active August 29, 2015 14:06
sample code for https://paiza.jp/poh/kirishima with awk over Java.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
public class Main {
public static void main(String[] args) throws Exception {
StringBuilder script = new StringBuilder();
class Fraction {
/**
* 値を素因数分解して返します。
* 素数を x で連結する表記です。
* 10 => 2x2x5x5
* */
static String factorize(long val) {
if(val == 1L){
return "1";
}
@kazurof
kazurof / BasicAuthComponent.php
Last active January 10, 2016 13:02
CakePHPでBASIC認証をするComponent ref: http://qiita.com/kazurof/items/94a07b672f062e2db568
<?php
class BasicAuthComponent extends Component {
public function startup(Controller $controller) {
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] !== BASIC_USERID || $_SERVER['PHP_AUTH_PW'] !== BASIC_PASSWD) {
$controller->autoRender = false;
$controller->response->header('WWW-Authenticate: Basic realm="Please enter your ID and password"');
$controller->response->statusCode(401);
$controller->response->send();
$this->_stop("id / password Required");
}
package org.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/sample")
public class EndPoint {
@kazurof
kazurof / Kantoka.java
Last active February 5, 2016 01:23
GradleでJavaアプリを実行する最小構成サンプル ref: http://qiita.com/kazurof/items/d5b00f7baf2b1699257d
package org.example;
import org.apache.commons.lang3.SystemUtils;
import java.util.Arrays;
public class Kantoka {
public static void main(String[] args) {
System.out.println("This is Kantoka");
System.out.println(args.length);
@kazurof
kazurof / Calc.java
Last active February 12, 2016 13:12
mockitoとJMockitについてのメモ ref: http://qiita.com/kazurof/items/1171c7e038050453c6c9
package org.example;
public class Calc {
int remainder(int dividend, int divisor) {
return dividend % divisor;
}
}