Skip to content

Instantly share code, notes, and snippets.

@tomoTaka01
tomoTaka01 / Sample.html
Created October 18, 2015 09:36
JavaScript Promise Sample
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="js/vender/bootstrap-3.3.5-dist/css/bootstrap.css" rel="stylesheet">
<title>Promise Sample</title>
</head>
<body>
<div class="container">
@tomoTaka01
tomoTaka01 / polyline sample
Created January 1, 2015 00:10
google polyline sample
<!DOCTYPE html>
<html>
<head>
<title>Google Map Marker Sample</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<style>
#map_canvas {
width: 850px;
@tomoTaka01
tomoTaka01 / JavaScript Sample1
Created November 16, 2014 09:03
just some sample
<!DOCTYPE html>
<html>
<head>
<title>sample</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./js/vendor/jquery-1.11.1.js"></script>
<script src="./js/vendor/jquery-cookie/jquery.cookie.js"></script>
<script>
$(document).ready(function(){
@tomoTaka01
tomoTaka01 / on Java6
Last active August 29, 2015 14:04
1時間毎の時間を取得するサンプル(Java6,Java8) Getting every one hour using Java6 and Java8
private void test1() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
for (int i = 0; i < 48; i++) {
calendar.add(Calendar.HOUR, 1);
System.out.println(format.format(calendar.getTime()));
@tomoTaka01
tomoTaka01 / gist:0b9fee7d46e856f41b76
Created July 21, 2014 04:49
Printing Daylight Saving Time by Java8
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.stream.IntStream;
/**
* Printing Date Time by Java8(Date & Time).
@tomoTaka01
tomoTaka01 / gist:cf7bef93f748546e9351
Created July 12, 2014 02:30
creating zip file without input files.
private void zipFromString(){
// zipファイルに含めるファイル(ディレクトリも指定)
List<String> files = Arrays.asList(
"dir1/test1.txt"
, "dir1/dir2/test2.txt");
ZipOutputStream out = null;
try {
// zipファイル指定
out = new ZipOutputStream(new BufferedOutputStream(
new FileOutputStream("/Users/tomo/ziptest/myzip.zip")));
@tomoTaka01
tomoTaka01 / Adder.as
Created April 13, 2014 05:56
Flex closure sample
import flash.events.MouseEvent;
import mx.controls.Alert;
private function init():void {
this.result.text = "0";
this.add1Button.addEventListener(MouseEvent.CLICK, add(1));
this.add2Button.addEventListener(MouseEvent.CLICK, addWithObject(2, this));
this.addDiv.addEventListener(MouseEvent.CLICK, addHistory);
}
private function add(addVal:int):Function {
@tomoTaka01
tomoTaka01 / AdderSample.js
Created April 13, 2014 05:13
Simple closure sample.
<!DOCTYPE html>
<html>
<head>
<title>Adder Sample(java script)</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="js/libs/jquery/jquery.js" ></script>
<script>
$(function() {
$('#result').text('0');
@tomoTaka01
tomoTaka01 / temperature using JavaFX
Created September 29, 2013 12:40
get the temperature from RaspberryPi and show it on the JavaFX8 screen. The temperature and time show up every 5 seconds.
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import javafx.application.Application;
import javafx.concurrent.ScheduledService;
import javafx.concurrent.Task;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
@tomoTaka01
tomoTaka01 / gist:6700138
Created September 25, 2013 14:05
The temperature application using JavaFX and RaspberryPi.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;