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
/** | |
* WebStorageでQueueを管理するクラス | |
* @class WebStorageQueue | |
*/ | |
;WebStorageQueue = (function() { | |
'use strict'; | |
function WebStorageQueue(storage, key) { | |
if(!storage) { | |
throw new Error('Storageオブジェクトが取得できませんでした。'); | |
} |
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
location.pathname.replace(/\/+$/, "").split('/').pop(); |
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 | |
/** | |
* JPEGのEXIF情報を削除します。 | |
* 元画像は削除した上で変換後のファイルを置き換えます。 | |
* @param string $path 画像パス | |
* @return boolean | |
*/ | |
function removeExif($path) { | |
$status = true; | |
list(, , $type) = getimagesize($path); |
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 App\Controller\Component; | |
use \google\appengine\api\mail\Message; | |
use Cake\Controller\Component; | |
/** | |
* メール送信を行うコンポーネント | |
*/ | |
class MailComponent extends Component | |
{ |
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 | |
$this->Components->load('RequestHandler')->renderAs($this, 'json'); | |
$response = array(); | |
$this->set($response); | |
$this->set('_serialize', array_keys($response)); |
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 | |
function defer_stylesheet() { | |
$styles = array( | |
'//fonts.googleapis.com/css?family=Lato:300,400,400italic,600,700|Raleway:300,400,500,600,700|Crete+Round:400italic', | |
'//fonts.googleapis.com/earlyaccess/notosansjapanese.css', | |
get_template_directory_uri(). '/css/bootstrap.css', | |
); | |
$styles = json_encode($styles); | |
echo <<<SCRIPT | |
<script> |
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
/** | |
* main | |
*/ | |
function main() { | |
var tagName = 'php'; | |
var questionUrl = 'https://teratail.com/questions/'; | |
var response = getQuestionByTagName(tagName, {limit: 3}); | |
if(!'questions' in response) { | |
return false; | |
} |
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 | |
$sanitize = function($data) use (&$sanitize) { | |
foreach($data as &$value) { | |
if(is_array($value)) { | |
$value = $sanitize($value); | |
} else { | |
$value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); | |
} | |
} | |
return $data; |
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
/** | |
* HTML5 WebSpeechAPI SpeechSynthesis | |
* @class Speech | |
*/ | |
var Speech = (function() { | |
// 存在チェック | |
if (!'SpeechSynthesisUtterance' in window) { | |
throw new Error('SpeechSynthesisAPI unsupported.'); | |
alert('SpeechSynthesisAPIが対応していないブラウザです。'); |
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
/** | |
* スピナーオブジェクト | |
*/ | |
var Spinner = function() { | |
/** | |
* ランダムでIDを生成する | |
*/ | |
this.id = 'spinner' + Math.floor(Math.random () * 10000) + 1; | |
}; | |
Spinner.prototype = { |