Skip to content

Instantly share code, notes, and snippets.

Avatar

ChihiroMazda chihirokaasan

View GitHub Profile
@chihirokaasan
chihirokaasan / main.js
Created Mar 2, 2018
Vue.jsプラグインsortable.js の読み込み
View main.js
import Sortable from 'vue-sortable/vue-sortable.js'
Vue.use(Sortable)
@chihirokaasan
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"] == "testURL.jp") {
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', '127.0.0.1');
@chihirokaasan
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()
{
parent::initialize();
@chihirokaasan
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
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
chihirokaasan / php-to-MySQL
Created Jul 24, 2017
PHPからMySQLへ繋ぐ際のサンプル
View php-to-MySQL
<?php
$dsn = 'mysql:host=172.17.0.2;dbname=your-database-name';
$username = 'root';
$password = 'your-root-password';
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$dbh = new PDO($dsn, $username, $password, $options);
@chihirokaasan
chihirokaasan / howToGetContainerIPAddress
Created Jul 24, 2017
DockerのコンテナのnameまたはIDからIPアドレスを取得
View howToGetContainerIPAddress
docker inspect --format '{{ .NetworkSettings.IPAddress }}' your-container-name-or-id
@chihirokaasan
chihirokaasan / container-login
Created Jul 24, 2017
Dockerのコンテナにアクセス
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
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
chihirokaasan / DockerFile
Created Jul 24, 2017
CentOS7のapacheベースのphp7のイメージ
View DockerFile
FROM centos:centos7
MAINTAINER matsuda
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN yum -y install wget epel-release
RUN wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN rpm -Uvh ./remi-release-7.rpm
RUN sed -i '4a priority=1' /etc/yum.repos.d/remi-php71.repo