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 / 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 / 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 / Month.php
Created March 9, 2015 04:41
メモ:Doctrine2でmysqlのYEAR,Monthを使えるようにするためのExtension
<?php
namespace Nanaweb\Doctrine\DateFunctionExtension;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
@77web
77web / add_frontmatter.php
Last active August 29, 2015 14:15
特定のディレクトリ配下にあるプレーンな.md,.markdownファイル全部にfrontmatterをつけるスクリプト
<?php
$targetDir = __DIR__.'/awos';
$dir = dir($targetDir);
$mdFiles = [];
while ($file = $dir->read()) {
if (false !== strpos($file, '.md') || false !== strpos($file, '.markdown')) {
$mdFiles[] = $file;
}
}
@77web
77web / grouping.js
Created January 13, 2015 12:26
配列をグルーピングするパターンを全列挙するやつ(js)試作品(未完成)
G = {
grouping: function(elements) {
var i,j,k = 0;
var groups= [];
for (i = 1; i <= elements.length; i++) { // i:分割後のグループ数
var grps = G.divideIntoGroups(elements, i);
for (j = 0; j < grps.length; j++) {
groups.push(grps[j]);
}