Skip to content

Instantly share code, notes, and snippets.

@oshiro-kazuma
oshiro-kazuma / hello.html
Created December 13, 2011 08:12
hello github
<html>
<head>
<title>hello</title>
</head>
<body>
<h1>hello</h1>
</body>
</html>
@oshiro-kazuma
oshiro-kazuma / ComparatorSortExample.java
Created June 22, 2012 11:13
Java標準クラスでソート
// List<HogeBean> beans = Hoge.findAll();
Collections.sort(beans, new Comparator<HogeBean>() {
@Override
public int compare(HogeBean o1, HogeBean o2) {
int comp = compareString(o1.getKey(), o2.geKey());
if (comp != 0) {
return comp;
}
return 0;
}
@oshiro-kazuma
oshiro-kazuma / HogeBean.java
Created June 22, 2012 11:25
Commons Collectionsを使った複合ソート
// HogeBean.java
public class HogeBean {
private int age;
private String name;
private String hometown;
public HogeBean(int age, String hometown, String name) {
this.setAge(age);
this.hometown = hometown;
@oshiro-kazuma
oshiro-kazuma / gmap_tips1.html
Created June 23, 2012 18:54
GoogleMapでカレログみたいな画面を
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/zocial.css" />
<style type="text/css">
html { height: 100% }
body {
height: 100%;
margin: 0px;
@oshiro-kazuma
oshiro-kazuma / log_download.ttl
Created June 28, 2012 01:23
scpでログをダウンロードするTeraTermマクロ
;; log_download.ttl
;;
;; TeraTermマクロ
;; コマンド実行後、scpでファイルをダウンロード。
;; Setting
HOSTADDR = '127.0.0.1'
USERNAME = 'username'
PASSWORD = 'password'
LOCALPATH = 'c:\work\'
@oshiro-kazuma
oshiro-kazuma / dbi_test.pl
Created June 30, 2012 01:22
DBIに入門した
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use DBI;
my $database = 'test.db';
my $data_source = "dbi:SQLite:dbname=$database";
my $dbh = DBI->connect($data_source);
@oshiro-kazuma
oshiro-kazuma / PdoDao.php
Created August 2, 2012 09:38
PHPでmemcachedを使うとき
<?php
class PdoDao {
const user = "hogehoge";
const pass = "hogehoge";
const memSec = 10;
private $pdo;
private $m;
@oshiro-kazuma
oshiro-kazuma / bless_test.pl
Created August 27, 2012 18:01
Perlのオブジェクトの動きを確認
#!/usr/bin/env perl
use strict;
use Data::Dumper;
my $obj = Hoge->new({
str => 'http://hogehoge/',
hoge => 'foobar'
});
warn Dumper $obj;
@oshiro-kazuma
oshiro-kazuma / index.php
Created September 16, 2012 13:38
PHPでCSVデータを生成
<?php
// SilexとDoctrine使ってる感じで
$app->get('/csv/userlist/{id}.csv', function ($id) use ($app) {
// DBのデータを連想配列のリストで取得
$sql = "select * from user where result = 1 and groupid = ?";
$stmt = $app['db']->prepare($sql);
$stmt->bindValue(1, $id);
$stmt->execute();
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
@oshiro-kazuma
oshiro-kazuma / imapFetch.pl
Created October 21, 2012 16:37
perlでgmailに接続
#!/usr/bin/env perl
use Net::IMAP::Client;
use Data::Dumper;
use strict;
use warnings;
my $imap = Net::IMAP::Client->new(
server => $ARGV[0],
user => $ARGV[1],