Skip to content

Instantly share code, notes, and snippets.

View 77web's full-sized avatar

Hiromi Hishida 77web

View GitHub Profile
@77web
77web / php.ini
Created January 24, 2024 12:19
handling form submission in PHP without $_FILES, $_POST(#phpstudyでymfuruyaさんが発表された内容を試したもの)
enable_post_data_reading=Off
@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
@77web
77web / app.php
Created May 22, 2022 01:39
継承でもいいかもしれないやつ
<?php
class AnswerToゲームほしい implements AnswerStrategyInterface
{
public function supports(string $ask): bool
{
return $ask === 'ゲームほしい';
}
@77web
77web / FooJob.php
Created December 19, 2020 04:16
Laravelのキュー周りこういう書き方したらだめですかね?
<?php
namepace App\Jobs;
// 略
class FooJob implements ShouldQueue
{
private $param1;
private $param2;
@77web
77web / map.json
Created April 9, 2020 05:55
AdWordsAPIの項目→GoogleAdsAPIの変換マップjson(元ネタ https://developers.google.com/google-ads/api/docs/migration/reports
{"AccountCurrencyCode":"customer.currency_code","AccountDescriptiveName":"customer.descriptive_name","AccountTimeZone":"customer.time_zone","ActiveViewCpm":"metrics.active_view_cpm","ActiveViewCtr":"metrics.active_view_ctr","ActiveViewImpressions":"metrics.active_view_impressions","ActiveViewMeasurability":"metrics.active_view_measurability","ActiveViewMeasurableCost":"metrics.active_view_measurable_cost_micros","ActiveViewMeasurableImpressions":"metrics.active_view_measurable_impressions","ActiveViewViewability":"metrics.active_view_viewability","AdNetworkType1":"AdNetworkType1 and AdNetworkType2 have been combined into segments.ad_network_type","AdNetworkType2":"segments.ad_network_type","AllConversionRate":"metrics.all_conversions_from_interactions_rate","AllConversionValue":"metrics.all_conversions_value","AllConversions":"metrics.all_conversions","AverageCost":"metrics.average_cost","AverageCpc":"metrics.average_cpc","AverageCpe":"metrics.average_cpe","AverageCpm":"metrics.average_cpm","AverageCpv":"metr
@77web
77web / 大きいほうが外.php
Created October 31, 2018 01:31
ネストforeachの配列ウチソト問題の計測用
<?php
$array1 = range(1, 1000000);
$array2 = range(1, 10);
$start = microtime(true);
$result = [];
foreach ($array1 as $value1) {
foreach ($array2 as $value2) {
$result[] = $value1 * $value2;
@77web
77web / ControllerTrait.php
Created December 7, 2017 02:04
最強のControllerTrait
<?php
namespace App\Controller;
use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Extension\Core\Type\FormType;
@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

DTD

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

文字コード

  1. 別途指定が無い限りBOMなしのUTF-8を使用してください。