Skip to content

Instantly share code, notes, and snippets.

table {
font-size: 90%;
color: #333;
margin-bottom: 30px;
border: 1px solid #CCCCCC;
border-collapse: separate;
border-spacing: 1px;
}
th {
function maketable($array){
$ret='<table>';
$tableheader=array_keys($array[0]);
$ret.="<tr>";
foreach($tableheader as $name){
$ret.="<th>$name</th>\n";
}
$ret.="</tr>\n";
foreach($array as $i=>$row){
// array2excel($table,$label) ;
function array2excel($table,$formlabel=""){
$today=date('Ymd');
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=data_{$today}.xls");
//http://ascii.jp/elem/000/000/477/477758/index-2.html
#glayLayer{
display:none;
position:fixed;
(中略)
}
#overLayer{
display:none;
position:fixed;
@tamura
tamura / tsv2hash.php
Created March 4, 2011 07:57
convert tsv data to hash arrays. the keys of the hashes are defined by the first row.
<?php
$tsv=file_get_contents("https://spreadsheets.google.com/pub?key=XXXXXXXXXX&output=txt");
function tsv2hash($txt){
$txt=str_replace("–", "-", $txt);
$arrtmp=explode("\n",$txt);
@tamura
tamura / scroll hexal
Created March 10, 2011 03:02
javascript
function hexa1() {
var nn =2000+$(window).scrollTop();
var n16=0;
var ans ="";    
while (nn > 0) {
n16=nn%16;    
nn=(nn-n16)/16;
ans=bunrui(n16) + ans;  
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script src="http://semooh.jp/jquery/js/jquery.js"></script>
<style type="text/css">
.transform_scale{
float:left;
background-color:#aaaaaa;
@tamura
tamura / affiliation
Created March 18, 2011 02:58
職業
A:専門的・技術的職業従事者
B:管理的職業従事者
C:事務従事者
D:販売従事者
E:サービス職業従事者
F:保安職業従事者
G:農林漁業作業者
H:運輸・通信従事者
I:生産工程・労務作業者
J:その他
$sql=sprintf("INSERT INTO `registration` (`%s`)VALUES (%s);"
,implode("` ,`",array_keys($allitems))
,implode(",",array_fill(1,count($allitems),"?") )
);
$registration=$pdo->prepare($sql);
$registration->execute(array_values($allitems));
$regnum=$pdo->lastInsertId();
@tamura
tamura / xml excel php
Created April 19, 2011 08:52
excel xml 改行ありのデータを変換 php
echo '<Cell><Data ss:Type="String">';
echo str_replace("<br>", '&#10;',nl2br($val) ) ;
echo "</Data></Cell>\n";
function ooo($val){
$val=str_replace("<br>", '&#10;',nl2br($val) ) ;
$val = str_replace("<br clear=both>", '</Data></Cell><Cell><Data ss:Type="String">',$val ) ;