Skip to content

Instantly share code, notes, and snippets.

@shimabox
shimabox / Sample_PhpDocumentor_Hoge.php
Last active August 17, 2022 00:54
phpDocumentorのちょっとしたサンプル
<?php
/**
* PHPDocumentorのちょっとしたサンプル
* @author shimabox
*/
/**
* require
*/
require_once './Interfaces/IHoge.php';
@shimabox
shimabox / alog.js
Last active December 19, 2015 02:39
/*@cc_on!@*/false だけでIEかどうかの判定ができると聞いて / alertとconsole.logのラッパー的な / 名前も簡易(alert + console.log)
;(function(ns){
if(typeof ns.alog === 'function') return;
ns.alog = function(){
var args = [].slice.call(arguments).concat();
if (/*@cc_on!@*/false) {
return alert(args);
}
@shimabox
shimabox / gem_mailcatcher.rb
Last active August 29, 2015 14:14
mailcatcherのレシピ(gem eventmachineをダウングレードして動かす)
# Cookbook Name:: app
# Recipe:: mailcatcher
#
# Copyright 2015, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
# rubyとgem は既に入っている想定
# ruby -v => 2.0.0p598
@shimabox
shimabox / gem_mailcatcher
Created March 5, 2015 21:20
mailcatcherのレシピ
#
# Cookbook Name:: app
# Recipe:: mailcatcher
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
# rubyとgem は既に入っている想定
@shimabox
shimabox / phpunit_ajax_sample.php
Last active June 22, 2017 05:44
jsonを返すAPIのテストコード
<?php
/**
* メッセージ(json)を返すAPIと仮定
*
* あくまでもサンプルなので例外処理は入れていません
*/
class Sample
{
/**
* @var array
@shimabox
shimabox / test_for_use_the_header_function.php
Created December 12, 2016 23:08
header関数を使うメソッドのテストコード
<?php
/**
* メッセージ(json)を返すAPIと仮定
*
* あくまでもサンプルなので例外処理は入れていません
*/
class Sample
{
/**
* @var array
@shimabox
shimabox / d3_sample.html
Last active December 31, 2016 11:20
Visualize the benchmark by d3.js
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Visualize the benchmark by d3.js</title>
<style>
body {
font: 12px sans-serif;
}
.axis path,
@shimabox
shimabox / getUrlStatus.php
Last active August 7, 2017 22:30
URLを渡すとヘッダー情報を見てステータスを返す
<?php
/**
* URLのステータスを返す
*
* <code>
* $ret = getUrlStatus($url);
*
* $ret->url; // string URL<br>
* $ret->reachedUrl; // string 最後に到達したURL<br>
* $ret->isValid; // bool 有効なURLか<br>
@shimabox
shimabox / PHPUnitとPHPのバージョン対応表.md
Last active August 17, 2017 22:41
PHPUnitとPHPのバージョン対応表
@shimabox
shimabox / face_and_eye_recognition.py
Last active October 19, 2021 02:39
WEBカメラの映像から顔と目を検出して目にはモザイクをかけるやつ(Python+OpenCV)
import sys
import cv2 # OpenCV のインポート
'''
参考
@link http://ensekitt.hatenablog.com/entry/2017/12/19/200000
@link https://note.nkmk.me/python-opencv-face-detection-haar-cascade/
@link https://note.nkmk.me/python-opencv-mosaic/
@link http://workpiles.com/2015/04/opencv-detectmultiscale-scalefactor/
'''