Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / build.sh
Last active January 24, 2020 04:02
install php 5.6.40 with brew
## install openssl 1.0.2t
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/
git checkout 8b9d6d688f483a0f33fcfc93d433de501b9c3513 -- openssl.rb
brew install openssl
## build php: "/usr/local/Cellar/icu4c/64.2" is a specific icu4c version.
LDFLAGS=-L/usr/local/Cellar/icu4c/64.2 \
CONFIGURE_OPTS="--with-pear --with-openssl=/usr/local/Cellar/openssl/1.0.2t --with-icu-dir=/usr/local/Cellar/icu4c/64.2" \
phpenv install 5.6.40
@nojimage
nojimage / rector.sh
Created January 10, 2020 08:44
rector on docker の起動コマンドサンプル
docker run --rm -v "$(pwd)":/app -w /app --entrypoint /rector/bin/rector rector/rector process src --dry-run
@nojimage
nojimage / genuuid4.php
Last active November 26, 2019 10:58 — forked from tanakahisateru/genuuid4.php
NEVER USE this UUIDv4 generator
#!/usr/bin/env php
<?php
/**
* composer init && composer require cakephp/utility:^3.8
*
* Try < PHP 5.6: ./genuuid4.php 65536 | sort | uniq -d
*/
require 'vendor/autoload.php';
use Cake\Utility\Text;
@nojimage
nojimage / Chrome.php
Last active November 5, 2019 10:45
Codeception / WebDriver / ChromeDriver でモバイルエミュレーションする
<?php
/**
*
* Copyright 2018 ELASTIC Consultants Inc.
*
*/
namespace Helper\MobileEmulation;
use Codeception\Module;
@nojimage
nojimage / bootstrap_cli.php
Last active October 30, 2019 03:15
Bake Entity with column comment
<?php
// in bootstrap_cli.php
if (PHP_SAPI === 'cli' && Configure::read('debug')) {
// Bake書き換え
EventManager::instance()->on('Bake.beforeRender', static function (Event $event) {
$view = $event->getSubject();
/* @var $view View */
// for Bake Entity
if ($view->get('propertySchema') && $view->get('table') && $view->get('name')) {
// propertySchemaを書き換えてスキーマコメントを付与する
<?php
/**
* Copyright 2018 Takashi Nojima.
*/
namespace App\Routing;
use Cake\Controller\Controller;
use Cake\Http\ControllerFactory;
use Cake\Http\Response;
@nojimage
nojimage / gist:8553345
Created January 22, 2014 04:08
postfix のキューに溜まったメールのうち指定のメール文をもつメールを送信保留する
sudo find /var/spool/postfix/deferred/ -type f -exec grep -l 'search body test' '{}' \; | xargs -n1 basename | xargs -n1 sudo postsuper -h
function hash_get(key, haystack) {
const keys = key.split('.');
if (!Object.prototype.hasOwnProperty.call(haystack, keys[0])) {
return null;
}
const matched = haystack[keys[0]];
if (keys.length === 1) {
return matched;
}
@nojimage
nojimage / ChunkInsertTestFixture.php
Last active May 17, 2019 03:54
CakePHP 3 TextFixture for many records
<?php
namespace App\TestSuite\Fixture;
use Cake\Datasource\ConnectionInterface;
use Cake\TestSuite\Fixture\TestFixture;
/**
* ChunkInsertTestFixture
*/
abstract class ChunkInsertTestFixture extends TestFixture
@nojimage
nojimage / .gitlab-ci.yml
Last active December 4, 2018 06:02
Exclude run CI job on "WIP:" or "@wip" in the commit message
(...snip...)
- vendor/bin/phpunit --coverage-text --colors=never --exclude-group=external
except:
variables:
- $CI_COMMIT_MESSAGE =~ /(?:^WIP:)|@WIP/i