Skip to content

Instantly share code, notes, and snippets.

@shoheikawano
shoheikawano / sample code from the textbook
Created November 20, 2012 04:11
Java Assertion code from Code Complete McConnell, Steve - Chapter 8
assert denominator !=0 : "denominator is unexpectedly equal to 0.";
@shoheikawano
shoheikawano / User Stories for HPU Mens Basketball Team
Created December 6, 2012 08:16
User Stories & Scenarios for HPU Men's Basketball Team
Feature: Having Efficient Game Data Management System
As a HPU Men's Basketball Coach
So I can summarize extensive data
I want summary statistics updated automatically when I enter new data
Scenario: have a efficient game data management system
Given I am in the data managemenet system
When I go to the individual player's page
And I enter 1 to 'Last 5 Make' section of 'Region 1'
And I press enter
@shoheikawano
shoheikawano / gist:4283008
Created December 14, 2012 05:59
This is the 'Hello World' code example from Node.js official website.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
node filename.js
body{margin: 0 px;padding: 0 px;}
body{margin:0;padding:0}
@shoheikawano
shoheikawano / gist:7769613
Created December 3, 2013 14:05
FizzBuzz書いてみた
package kata;
public class fizzbuzz {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
if(i % 15 == 0) {
System.out.println("FizzBuzz!!!");
@shoheikawano
shoheikawano / Test.java
Created April 14, 2014 16:38
(初心者メモ)Javaでの足し算で予想外な挙動とその対策 ref: http://qiita.com/shohe_i/items/6e34d7ac2704bff965b3
public class Test {
public static void main(String[] args) {
System.out.println("加算の結果は" + 3 + 2 + "です。");
}
}
@shoheikawano
shoheikawano / file0.txt
Created April 15, 2014 11:50
プログラミング初歩見習いのJavaメモ / char型からint型への変換 ref: http://qiita.com/shohe_i/items/b8bdd9517e293d0a1adb
public static void main (String[] args) {
int sum = 0;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)) {
while(sum == 0) {
System.out.print("3桁の数値を入力してください: ");
String line = reader.readLine();
for(int i = 0; i < line.length(); i++) {
char ch = line.charAt(i);
try {
sum += Character.getNumericValue(ch);
@shoheikawano
shoheikawano / file0.txt
Created April 16, 2014 11:33
プログラミング初歩見習いのJavaメモ / ラベル付きループ ref: http://qiita.com/shohe_i/items/518cfb6ad00f819ff0f6
loop1:
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 5; j++) {
if (j==3) {
break loop1;
}
System.out.println("i=" + i + ", j=" + j);
}
}