Skip to content

Instantly share code, notes, and snippets.

View 77web's full-sized avatar

Hiromi Hishida 77web

  • linkage-inc
  • Nagoya, Aichi, Japan
  • X @77web
View GitHub Profile
@77web
77web / excel-generator.php
Created September 10, 2014 03:45
最小限のexcelファイルを新規作成する試作品
<?php
$contentTypeXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Default Extension="xml" ContentType="application/xml"/>
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>
</Types>';
@77web
77web / file0.txt
Created July 10, 2014 14:01
BEAR.SundayでDoctrine2のORMを使ってみた ref: http://qiita.com/77web@github/items/7b67e490ac59dcab0ca8
composer create-project bear/skeleton My.NoteApp
cd My.NoteApp
composer install
@77web
77web / test.csv
Last active August 29, 2015 14:02
strange behavior of \SplTempFileObject and php://temp
test1 test2 test3
test4 test5 test6
@77web
77web / FileUploadType.php
Created February 17, 2014 08:50
bad example. validation configuration using FormEvent
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class FileUploadType extends AbstractType
{
@77web
77web / opActivityTweetPluginConfiguration.class.php
Last active December 19, 2015 10:09
unit test using Phake in OpenPNE3(finally working!!)
<?php
class opActivityTweetPluginConfiguration extends sfPluginConfiguration
{
public function configure()
{
//hack member config
$this->dispatcher->connect('op_action.pre_execute_member_config', array($this, 'listenToPreMemberConfig'));
//manual post
@77web
77web / 1_security.yml
Created February 25, 2013 07:23
How to switch user accounts between two(or more) different firewalls when using Symfony\Bundle\SecurityBundle
//you may have some more configs here...
providers:
user:
entity: { class: MyAppBundle:User, property: loginEmail }
admin:
entity: { class: MyAppBundle:Admin, property: username }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

DTD

  1. 別途指定がない限りHTML5又はXHTML1.0を使用してください。
  2. 文字コード指定がUTF-8の場合、XML宣言は含めないでください。

文字コード

  1. 別途指定が無い限りBOMなしのUTF-8を使用してください。
@77web
77web / AbleBakerType.php
Last active December 11, 2015 00:18
Symfony2のFormで現在困ってるところ。 Able - AbleBakerのOneToMany Able - AbleCharieのOneToMany AbleBaker - AbleCharieのManyToMany があって、Ableのフォーム内でAbleBakerを編集したい。 AbleBakerTypeでのAbleCharieの選択肢を同じAbleに属するものに限定したいのだが、collectionとして使った場合にAbleBakerType内で関連付けられてるAbleBakerエンティティを取得する方法が無いため、どのAbleに属しているか特定できない。
<?php
namespace Acme\DemoBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Acme\DemoBundle\EntityRepository\AbleCharieRepository;
@77web
77web / sfWidgetFormSchemaFormatterBootstrap.class.php
Created October 19, 2012 09:44
twitter bootstrapのHTMLを出すためのsfForm用formatter
<?php
/**
* sfFormのフォームでtwitter bootstrap用のHTMLを出力するformatterクラス
*
* @auther Hiromi Hishida<info@77-web.com>
*/
class sfWidgetFormSchemaFormatterBootstrap extends sfWidgetFormSchemaFormatter
{
protected $rowFormat = '<fieldset class="%status%"><div class="control-group">%label%<div class="controls">%error%%field%%help%%hidden_fields%</div></div></fieldset>';
protected $errorRowFormat = '%errors%';
@77web
77web / the_best_way_for_functional_test.php
Created July 30, 2012 10:31
機能テストの書き方について。
<?php
// modules/foo/actions/actions.class.php
class fooActions extends sfActions
{
public function executeBar(sfWebRequest $request)
{
//何かの計算や条件判定
$this->showNameInTitle = true;
$this->name = 'my name';
}