Skip to content

Instantly share code, notes, and snippets.

View onocom's full-sized avatar

Ono Takashi onocom

View GitHub Profile
//https://developers.google.com/maps/articles/phpsqlsearch_v3#outputting-xml-with-php
// Search the rows in the markers table
$query = sprintf("SELECT address, name, lat, lng, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20",
mysql_real_escape_string($center_lat),
mysql_real_escape_string($center_lng),
mysql_real_escape_string($center_lat),
mysql_real_escape_string($radius));
$result = mysql_query($query);
USE データベース名
SOURCE ファイル名
@onocom
onocom / responsive.css
Created June 27, 2016 02:13
responsive for bootstrap
@charset "UTF-8";
/**
* responsive.css
*/
/**
* [lg]LARGE DEVICE Desktop
*/
@media (min-width: 1200px) {
@onocom
onocom / CPI-WPCLI-PHP5516-batch.sh
Last active July 11, 2016 07:12
CPIのレンタルサーバにWPCLIをインストールする
# http://www.cpi.ad.jp/evangelist/maekawa/column01/001.html
cd ~
mkdir bin
cd bin/
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
cd ~
echo alias wp 'php-5.5.16 ~/bin/wp-cli.phar' > .cshrc
source .cshrc
wp --info
cd ~/html
wp plugin deactivate hello
wp plugin uninstall hello
wp plugin install contact-form-7 --activate
wp plugin install advanced-custom-fields --activate
wp plugin install wp-multibyte-patch --activate
@onocom
onocom / register.php
Last active July 4, 2016 09:25
concrete5のユーザ登録時にmauticにもユーザを追加する際のソースコード
<?php defined('C5_EXECUTE') or die("Access Denied.");
$token = \Core::make('Concrete\Core\Validation\CSRF\Token');
?>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="page-header">
<h1><?php echo t('Site Registration')?></h1>
<p>Mauticとの連携を試みます!</p>
</div>
@onocom
onocom / CPI-WPCLI-PHP7-batch.sh
Created July 11, 2016 07:13
CPIのレンタルサーバにWPCLIをインストールする PHP7版
# http://www.cpi.ad.jp/evangelist/maekawa/column01/001.html
cd ~
mkdir bin
cd bin/
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
cd ~
echo alias wp 'php-7.0 ~/bin/wp-cli.phar' > .cshrc
source .cshrc
wp --info
cd ~/html
@onocom
onocom / class-business-calendar.php
Last active October 31, 2016 07:39
営業日カレンダーを表示するクラス
<?php
class business_calendar {
const WEEK = 7; // 1 week is 7 days
// holiday_of_week flag index
const IDX_SUNDAY = 0;
const IDX_MONDAY = 1;
const IDX_TUESDAY = 2;
const IDX_WEDNESDAY = 3;
const IDX_THURSDAY = 4;
@onocom
onocom / google-map-link-url-memo.txt
Created December 20, 2016 08:12
GoogleMapのリンクURLのフォーマット
@onocom
onocom / japan-prefecture.html
Created March 4, 2017 04:16
都道府県を絞り込む処理
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>日本の都道府県一覧</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
jQuery(function ($) {