Skip to content

Instantly share code, notes, and snippets.


ChihiroMazda chihirokaasan

View GitHub Profile
chihirokaasan / main.js
Created Mar 2, 2018
Vue.jsプラグインsortable.js の読み込み
View main.js
import Sortable from 'vue-sortable/vue-sortable.js'
chihirokaasan / wp-config.php
Created Jan 9, 2018
WordPress config.php Switch databases in production and testing environments
View wp-config.php
/** WordPress のためのデータベース名 */
/** テスト環境のHOST */
if($_SERVER["HTTP_HOST"] == "") {
define('DB_NAME', 'test_DB_Name');
/** MySQL データベースのユーザー名 */
define('DB_USER', 'DB_Test_User_Name');
/** MySQL データベースのパスワード */
define('DB_PASSWORD', 'Test_DB_PASSWD');
/** MySQL のホスト名 */
define('DB_HOST', '');
chihirokaasan / AppController.php
Last active Sep 6, 2017
CakePHP3 redirect to SSL
View AppController.php
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;
class AppController extends Controller
public function initialize()
chihirokaasan / AppController.php
Last active Sep 6, 2017
CakePHP2 CakePHP1.3 redirect to SSL
View AppController.php
class AppController extends Controller
var $components = array('Security');
function beforeFilter()
// When you want to specify the action
*if ($this->action === 'index') {
* $this->Security->blackHoleCallback = 'forceSSL';
chihirokaasan / mysql-container
Created Jul 24, 2017
Docker のMySQLイメージからコンテナを作成
View mysql-container
docker run --name your-container-name -e MYSQL_ROOT_PASSWORD=your-mysql-root-password -d mysql:5.7
chihirokaasan / php-to-MySQL
Created Jul 24, 2017
View php-to-MySQL
$dsn = 'mysql:host=;dbname=your-database-name';
$username = 'root';
$password = 'your-root-password';
$options = array(
$dbh = new PDO($dsn, $username, $password, $options);
chihirokaasan / howToGetContainerIPAddress
Created Jul 24, 2017
View howToGetContainerIPAddress
docker inspect --format '{{ .NetworkSettings.IPAddress }}' your-container-name-or-id
chihirokaasan / container-login
Created Jul 24, 2017
View container-login
docker exec -it your-container-name bash
#例 MySQLのDockerコンテナにログインしてMySQLにアクセス
docker exec -it your-container-name bash
root@0your-container-name:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
chihirokaasan / command
Last active Jul 24, 2017
Docker run command
View command
docker run -v /your-app-source-dir:/var/www/html --privileged -d -p 8000:80 --name your-php-container-name your-php-image /sbin/init -DFOREGROUND
chihirokaasan / DockerFile
Created Jul 24, 2017
View DockerFile
FROM centos:centos7
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN yum -y install wget epel-release
RUN wget
RUN rpm -Uvh ./remi-release-7.rpm
RUN sed -i '4a priority=1' /etc/yum.repos.d/remi-php71.repo