Skip to content

Instantly share code, notes, and snippets.

View s-hiroshi's full-sized avatar

Hiroshi Sawai s-hiroshi

View GitHub Profile
@s-hiroshi
s-hiroshi / mediaquary.html
Created April 23, 2012 11:27
CSS > Media Query template
<html>
<head>
<style>
<link href="smartphone.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 0px) and (max-width: 320px)" />
<link href="tablet.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 321px) and (max-width: 768px)" />
<link href="tablet.css" rel="stylesheet" type="text/css" media="only screen and (min-width: 769px)" />
</head>
<body>
</body>
</tml>
@s-hiroshi
s-hiroshi / mediaquery.css
Created April 23, 2012 12:01
CSS > Media Query2
/**
* <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
**/
#foo {
margin: 0 auto;
min-width: 769px;
max-width: 980px;
}
#bar {
@s-hiroshi
s-hiroshi / index.html
Created May 8, 2012 04:32
jQuery > moodal window (greater than IE 7)
<h1>Modal Window</h1>
<ul style="list-style: none">
<li><a href="images/photo1.jpg" class="modal"><img src="images/photo1_thum.jpg" alt="写真1" /></a></li>
<li><a href="images/photo2.jpg" class="modal"><img src="images/photo2_thum.jpg" alt="写真2" /></a></li>
<li><a href="images/photo3.jpg" class="modal"><img src="images/photo3_thum.jpg" alt="写真3" /></a></li>
</ul>
@s-hiroshi
s-hiroshi / gist:2692130
Created May 14, 2012 06:18
WordPress > draw calender
/*
* カレンダー出力関数
* @param $id 投稿ID
* @param $y 年 数字4桁
* @param $m 月 数字1~13
* @param $days 日付 配列 添え字[1~31] 値[空, close, holiday]
*/
function drawCalender ($id, $y, $m, $days) {
// $y 年 $m 月
$t = mktime(0, 0, 0, $m, 1, $y); //$y年$m月1日のUNIXTIME
@s-hiroshi
s-hiroshi / createfile.php
Created May 14, 2012 06:31
PHP > create file
/**
* create file
*/
function createFile($dir, $file) {
$html = <<<HTML
<!DOCTYPE HTML>';
<html lang="en">';
<head>
<meta charset="UTF-8">
<title></title>
@s-hiroshi
s-hiroshi / connectmysql.php
Last active January 10, 2020 05:11
PHPでmysql_connect関数を使いMySQLへ接続するサンプルです。
<?php
// exampleデータベースにfield1, field2を持つtable1テーブルを作成済みの前提
// データベース接続情報
$url = "localhost";
$user = "root";
$password = "";
$database = "example";
// データベース接続処理
$connect = mysql_connect($url,$user,$password) or die("can't connect");
$db = mysql_select_db($database,$connect) or die("can't Select database");
@s-hiroshi
s-hiroshi / index.html
Created May 30, 2012 02:38
JavaScript > pattern > argument to callback function
<div id="hoge">
<p>Foo</p>
<p>Bar</p>
</div>
<div><button id="botton">Click</button></div>
@s-hiroshi
s-hiroshi / html5.html
Created June 13, 2012 06:38
HTML5 > template
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="robots" content="index,follow" />
<meta name="keywords" content="">
<meta name="description" content="">
<title>HTML5 Template</title>
<link rel="shortcut icon" href="/favicon.ico">
<link rel="index" href="/">
@s-hiroshi
s-hiroshi / mydate.js
Created June 13, 2012 06:47
JavaScript > custom function > date
//日付表記を変換
function changeDate(str) {
var myDate = new Date(str);
var YYYY = myDate.getFullYear();
var MM = myDate.getMonth() + 1;
if (MM < 10) {
MM = "0" + MM;
}
var DD = myDate.getDate();
if (DD < 10) {
@s-hiroshi
s-hiroshi / slideshow.js
Created June 15, 2012 01:37
jQuery > lib > random slideshow
var randomSlide = {
// property
ulArr: null,
totalSlide : 0,
currentSlide : 0,
isCompletedArr : [false,false,false,false,false,false],
// method
init : function(){
this.ulArr = $("#randomSlide ul");
this.totalSlide = this.ulArr.length;