Skip to content

Instantly share code, notes, and snippets.

@Restoration
Restoration / getTop.js
Created June 11, 2016 05:49
jQueryでTop取得
jQuery(function($){
//Get targetBox top
var targetBox = $('#targetBox').css('top').replace('px','');
//Format num
var targetBox = parseInt(targetBox,10);
});
@Restoration
Restoration / index.html
Created June 11, 2016 05:51
セレクトボックスの値を取得する
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<select name="select" id="select">
<option value="1">Value1</option>
<option value="2">Value2</option>
@Restoration
Restoration / index.html
Created June 11, 2016 05:52
setTimeoutで引数を渡す
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<script>
jQuery(function($){
@Restoration
Restoration / index.html
Created June 11, 2016 05:55
YYYMMDD形式をYYYY/MM/DD形式に変換
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<script>
var date = new Date();
var year = date.getFullYear();
@Restoration
Restoration / index.html
Created June 11, 2016 05:57
キャンバスのメモ
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Canvas</title>
</head>
<body>
<script>
onload = function(){
var canvas = document.getElementById('canvas');
@Restoration
Restoration / image_loop.php
Created June 16, 2016 16:00
PHPでjpgもしくはpngを取得して画像を表示
<ul>
<?php
//画像をループするよ(´・ω・`)
//ディレクトリ取得
$img_fld = 'image/product/'.$_REQUEST['name']. '/';
//ディレクトリ内の一覧を取得する
$img_list = scandir($img_fld);
//フォルダ内の画像の数を取得する
$count = count($img_fld);
//画像を表示させるよ!
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="flex-box">
<section>short text</section>
<section>long text long text</section>
@Restoration
Restoration / gist:13dd90b647e6848370ae4aea8ffa8bb1
Last active August 6, 2016 15:24
3の倍数のときだけアホになる.php
<?php
/*
//今月の日曜日をすべて表示
$year = date('Y');
$month = date('m');
echo '<h1>'.$year.'年'.$month.'月の日曜日</h1>';
for($i=1; $i <= 31; $i++){
if(checkdate($month,$i,$year)){
$week = date('w',mktime(0,0,0,$i,$month,$year));
if($week == 0){
@Restoration
Restoration / 定義済みの関数があるかを調べる.php
Created August 6, 2016 15:25
定義済みの関数があるかを調べる
<?php
define('TEST','PHP逆引きレシピ');
//定義済みの関数があるかを調べる
print_r(get_defined_constants(true));
//定義済みかどうかを調べる
<!DOCTYPE>
<html lang="ja">
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
/*
nullとは
ある変数が値をもたないことを表す