Skip to content

Instantly share code, notes, and snippets.

Avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / init-vmware-catalina.sh
Last active Mar 17, 2020
Fixes VMWare black screen when macOS update to Catalina
View init-vmware-catalina.sh
#!/bin/sh
#
# Running on macOS Recovery Mode Terminal
#
# 1. Save this script to Your home dir.
# eg) /Users/your-name/init-vmware-catalina.sh
#
# 2. Restart the machine and go to Recovery Mode.
# (hold [⌘ + R] when the computer starts until you see an Apple logo)
@nojimage
nojimage / build.sh
Last active Jan 24, 2020
install php 5.6.40 with brew
View build.sh
## 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 Jan 10, 2020
rector on docker の起動コマンドサンプル
View rector.sh
docker run --rm -v "$(pwd)":/app -w /app --entrypoint /rector/bin/rector rector/rector process src --dry-run
@nojimage
nojimage / genuuid4.php
Last active Nov 26, 2019 — forked from tanakahisateru/genuuid4.php
NEVER USE this UUIDv4 generator
View genuuid4.php
#!/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 / bootstrap_cli.php
Last active Oct 30, 2019
Bake Entity with column comment
View bootstrap_cli.php
<?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を書き換えてスキーマコメントを付与する
View hash_get.js
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
CakePHP 3 TextFixture for many records
View ChunkInsertTestFixture.php
<?php
namespace App\TestSuite\Fixture;
use Cake\Datasource\ConnectionInterface;
use Cake\TestSuite\Fixture\TestFixture;
/**
* ChunkInsertTestFixture
*/
abstract class ChunkInsertTestFixture extends TestFixture
View ControllerResolver.php
<?php
/**
* Copyright 2018 Takashi Nojima.
*/
namespace App\Routing;
use Cake\Controller\Controller;
use Cake\Http\ControllerFactory;
use Cake\Http\Response;
@nojimage
nojimage / .gitlab-ci.yml
Last active Dec 4, 2018
Exclude run CI job on "WIP:" or "@wip" in the commit message
View .gitlab-ci.yml
(...snip...)
- vendor/bin/phpunit --coverage-text --colors=never --exclude-group=external
except:
variables:
- $CI_COMMIT_MESSAGE =~ /(?:^WIP:)|@WIP/i
@nojimage
nojimage / Chrome.php
Last active Nov 5, 2019
Codeception / WebDriver / ChromeDriver でモバイルエミュレーションする
View Chrome.php
<?php
/**
*
* Copyright 2018 ELASTIC Consultants Inc.
*
*/
namespace Helper\MobileEmulation;
use Codeception\Module;
You can’t perform that action at this time.