This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyLibrary; | |
/** | |
* 日本語対応DateTime拡張クラス | |
* | |
* 元号、曜日などの日本語表記に対応したDateTime拡張クラス | |
* | |
* @version 1.0.2 | |
* @author chiyoyo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `prefecture` ( | |
`id` tinyint(3) unsigned NOT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`name_kana` varchar(255) DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 祝日かどうか判定できるDateTime拡張クラス | |
* usage: $holidayDateTime->holiday(); | |
*/ | |
class HolidayDateTime extends DateTime | |
{ | |
/** 祝日一覧 */ | |
// 種別: | |
// fixed=日付固定 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 汎用ツリー構造クラス | |
*/ | |
<?php | |
class TreeNode | |
{ | |
/** 本オブジェクトの親要素 */ | |
private $parent; | |
/** 本オブジェクトの子要素 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 小数点以下の桁数 | |
* @param {double} 数値 | |
* @param {integer} 小数点以下の桁数(省略可能) | |
* @return {double} 四捨五入した値 | |
*/ | |
Math.round = function (round_original) { | |
return function (number, pricision) { | |
var _pow; | |
switch (arguments.length) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 小数点指定できる四捨五入 | |
* http://qiita.com/chiyoyo/items/eac6d7cb4d3d6a6ab3fb | |
*/ | |
Math.round = function (round_original) { | |
return function (number, pricision) { | |
var _pow; | |
switch (arguments.length) { | |
case 1: | |
return round_original(number); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########## | |
# TDのテーブルを作成日時を見て削除していくバッチ | |
# 要jq:https://stedolan.github.io/jq/ | |
########## | |
##### 設定する場所 | |
# 残しておく期間 | |
EXPIRE_DAY=30 | |
# TD API KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CASE | |
-- 日本の座標の場合のみメッシュ変換をかける | |
WHEN 20.3 <= TRY_CAST(latitude AS DOUBLE) AND TRY_CAST(latitude AS DOUBLE) <= 45.6 AND 122 <= TRY_CAST(longitude AS DOUBLE) AND TRY_CAST(longitude AS DOUBLE) <= 154 THEN | |
CONCAT( | |
-- 1次メッシュ | |
TRY_CAST(TRY_CAST(FLOOR(TRY_CAST(latitude AS DOUBLE)*1.5) AS BIGINT) AS VARCHAR), | |
TRY_CAST(TRY_CAST(FLOOR(TRY_CAST(longitude AS DOUBLE))-100 AS BIGINT) AS VARCHAR), | |
-- 2次メッシュ | |
TRY_CAST(TRY_CAST(FLOOR(MOD(TRY_CAST(latitude AS DOUBLE)*60,40)/5) AS BIGINT) AS VARCHAR), | |
TRY_CAST(TRY_CAST(FLOOR(MOD(TRY_CAST(longitude AS DOUBLE)-100,1)*60/7.5) AS BIGINT) AS VARCHAR), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 2地点間の距離(m)を求める | |
* ヒュベニの公式から求めるバージョン | |
* | |
* @param float $lat1 緯度(始点) | |
* @param float $lon1 経度(始点) | |
* @param float $lat2 緯度(終点) | |
* @param float $lon2 経度(終点) | |
* @param boolean $mode 測地系 true:世界(default) false:日本 | |
* @return float 距離(m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 2地点間の距離を求める | |
* GoogleMapAPIのgeometory.computeDistanceBetweenのロジック | |
* 浮動小数点の精度が足りないためGoogleより桁数が少ないかもしれません | |
* | |
* @param float $lat1 緯度(始点) | |
* @param float $lon1 経度(始点) | |
* @param float $lat2 緯度(終点) | |
* @param float $lon2 経度(終点) | |
* @return float 距離(m) |
OlderNewer