Skip to content

Instantly share code, notes, and snippets.

@k-holy
k-holy / index.php
Created November 27, 2012 01:30
Volcanus_Csv(Writer+Reader)のサンプルSilex+PDO版
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
$app = new Application();
$app->get('/logs/', function(Application $app, Request $request) {
@k-holy
k-holy / composer.json
Created November 26, 2012 09:11
Volcanus\Csv\Writerの利用サンプル(Silex)
{
"require": {
"silex/silex": "1.0.*",
"doctrine/dbal": "2.2.*",
"volcanus/csv": "dev-master"
},
"minimum-stability": "dev"
}
@k-holy
k-holy / composer.json
Created November 13, 2012 10:14
Gehirn RS2を使ってみたメモ Silex + MySQL
{
"require": {
"silex/silex": "1.0.*",
"doctrine/dbal": "2.2.*"
},
"minimum-stability": "dev"
}
@k-holy
k-holy / .htaccess
Created November 12, 2012 10:11
Gehirn RS2でSilex使ってみたメモ
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(ico|gif|jpe?g|png|swf|pdf|css|js)$
RewriteCond %{REQUEST_URI} !index\.php$
RewriteRule .* index.php [NS,L]
@k-holy
k-holy / built-in-server.php
Created November 8, 2012 09:43
Silex + OptionsResolverでFizzBuzz
<?php
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (file_exists(realpath(__DIR__ . $path))) {
return false;
}
require __DIR__ . DIRECTORY_SEPARATOR . 'index.php';
@k-holy
k-holy / phpunit.xml
Created October 25, 2012 06:56
Stagehand_TestRunnerの設定ファイル
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="Tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
@k-holy
k-holy / splfileinfo.test.php
Created October 19, 2012 07:42
SplFileInfoのメソッド調査
<?php
namespace Acme;
class U
{
public static function H($data, $default=null)
{
$var = $default;
if (isset($data)) {
if (is_bool($data)) {
@k-holy
k-holy / .htaccess
Created September 25, 2012 11:09
シャットダウン関数でエラー処理
php_value auto_prepend_file __prepend.php
@k-holy
k-holy / .htaccess
Created September 21, 2012 09:21
auto_prepend_fileでエラー制御
php_value auto_prepend_file __prepend.php
@k-holy
k-holy / array_filter_and_merge.php
Created September 10, 2012 09:54
配列フィルタいろいろ
<?php
namespace Acme;
// フィルタに通れば上書き、なければそのまま
$data1 = array(
'name ' => '',
'age' => '20',
'notes' => 'HOGE',
);
$data2 = array(