Skip to content

Instantly share code, notes, and snippets.

View shingorow's full-sized avatar

松井 真吾 shingorow

View GitHub Profile
@shingorow
shingorow / OGP.html
Created June 17, 2022 01:54
OGPとTwitter Cardのチートシート
<!-- OGP -->
<meta property="og:url" content="{ url }" />
<meta property="og:type" content="{ website || article || blog || and more url(https://ogp.me/#types) }" />
<meta property="og:title" content="{ page_title } - { site_title }" />
<meta property="og:description" content="{ description }" />
<meta property="og:site_name" content="{ site_name }" />
<meta property="og:image" content="{ image_url }" /><!-- size 1200 * 630 -->
<!-- 確認ツール https://developers.facebook.com/tools/debug/?locale=ja_JP -->
<!-- Twitter Card -->
@shingorow
shingorow / CreateMultichoiceItem.gs
Last active October 5, 2017 04:47
Google Forms で申し込み数制限のある選択リストを作成するスクリプト
/**
* スプレッドシートから選択項目一覧を取得する
*
* @param {string} ssId スプレッドシートの ID
* @param {string} sheetName リストを記述してあるシート名
*
* @return {Object} 選択項目名のリスト
**/
var getMultichoiceItemList = function(ssId, sheetName) {
var ss = SpreadsheetApp.openById(ssId);
@shingorow
shingorow / file0.php
Last active May 31, 2022 00:32
Slim 3 で Eloquent の Query Builder を使って Pagination を実装する ref: http://qiita.com/shingorow/items/34315e1b7afe648cdfff
<?php
// ページ付き URL に強制転送
if (! array_key_exists('page', $args)) {
header('Location: /page/1');
exit;
}
// View に送るデータ
$values = [];
@shingorow
shingorow / file0.html
Created August 25, 2017 10:14
Vue.js を使って h1 タグの内容をもとにページ内リンクのリストを作る方法 ref: http://qiita.com/shingorow/items/3558217269c2b722dba5
<ul class="menu">
<li v-for="title in titles">
<a v-bind:href="'#'+title.href">{{ title.title }}</a>
</li>
</ul>
<article>
<header>
<h1 id="first" class="add-to-list">First article</h1>
</header>
<section>
@shingorow
shingorow / file0.js
Created August 24, 2017 10:57
JavaScript で秒や分を別の時間単位に変換する ref: http://qiita.com/shingorow/items/62eae5a87c85d1bcd0d2
(function (global) {
var TimeConvert = (function () {
function TimeConvert() {}
TimeConvert.prototype.sec2min = function (time) {
var min = Math.floor(time / 60);
var sec = time % 60;
return {
min: min,
@shingorow
shingorow / file0.js
Created August 24, 2017 07:31
noUiSlider を複数箇所で使うためのメモ ref: http://qiita.com/shingorow/items/0846192703445634c7ff
window.onload = function() {
var sliders = document.getElementsByClassName('slider');
for (var i = 0; i < sliders.length; i++) {
var slider = sliders[i];
var options = {
range: {
min: [0, 10],
max: [100]
},
@shingorow
shingorow / .htaccess
Created March 2, 2017 09:11
PHP の Slim 3 をレンタルサーバーで使うための設定
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_URI} !(^/public/)
RewriteRule ^ index.php [QSA,L]
@shingorow
shingorow / set-value-to-today.js
Created February 27, 2017 12:07
任意のクラスを持つ input タグの値に今日の日付をセットする
(function(global) {
function SetValueToToday(className) {
var date = new Date(),
year,
month,
day,
today;
this.className = className || 'set-value-to-today';
this.className = this.className.replace(/^\./, '');
function myFunction() {
var config = {}
config['spreadsheet'] = {
ssId: 'スプレッドシートの ID',
sheetName: 'リスト',
messageSheet: 'メッセージ',
testSheet: 'テスト',
displayValues: true,
emailLabel: 'メールアドレス'
@shingorow
shingorow / MessageTemplate.txt
Last active December 11, 2016 04:30
Google Form で入力されたメールアドレスに画像つき HTML メールを送信します。
<img width=200 src=cid:banner>
{ お名前 } 様
この度はお問い合わせいただき、ありがとうございます。
後ほど担当者より回答いたします。