Skip to content

Instantly share code, notes, and snippets.

View steinkel's full-sized avatar

Jorge M. González Martín steinkel

View GitHub Profile
@steinkel
steinkel / nginx + CakePHP 3 development environment for lazy devs
Last active July 11, 2022 16:15
nginx configuration for the lazy CakePHP developer
# Use only in your development environment, behind a firewall
sudo apt-get install dnsmasq
echo 'address=/.3dev/127.0.0.1' | sudo tee -a /etc/dnsmasq.conf
echo 'listen-address=127.0.0.1' | sudo tee -a /etc/dnsmasq.conf
sudo service dnsmasq restart
# now imlazy.3dev will resolve to localhost
# install nginx + php7
@steinkel
steinkel / app.php
Last active December 6, 2016 15:26
debugmail as a default debug transport in config/app.php
'EmailTransport' => [
'default' => [
'className' => 'Smtp',
'host' => 'debugmail.io',
'port' => 25,
'timeout' => 30,
'username' => 'YOUR_DEBUGMAIL_EMAIL',
'password' => 'YOUR_DEBUGMAIL_PROJECT_PASSWORD',
'client' => null,
'tls' => null,
@steinkel
steinkel / AppController.php
Created December 6, 2016 18:18
pick another layout for login page in CakeDC/Users
public function beforeRender(Event $e)
{
if ($this->request->param('action') === 'login' &&
$this->request->param('controller') === 'Users' &&
$this->request->param('plugin') === 'CakeDC/Users'
) {
$this->viewBuilder()->layout('login');
}
}
@steinkel
steinkel / cloud9 php7 cakephp
Last active March 29, 2017 14:54
Cloud9 PHP7 and CakePHP with Oven
#!/bin/bash
## Upgrade to php7 and install required dependencies
# execute this script using
# source <(curl RAW_GIST_URL)
read -p "You are about to upgrade to PHP 7 OK? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo 'y' | sudo add-apt-repository ppa:ondrej/php && \
sudo apt-get update && \
@steinkel
steinkel / cloud9 php7 cakephp
Last active August 26, 2019 14:43
Cloud9 PHP7 (7.1) and CakePHP with Oven
#!/bin/bash
## Upgrade to php7.1 and install required dependencies
# execute this script using
# source <(curl RAW_GIST_URL)
read -p "You are about to upgrade to PHP 7.1 OK? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo 'y' | sudo add-apt-repository ppa:ondrej/php && \
sudo apt-get update && \
# Installation: add this to your .bash_aliases or .zshrc
# change the following line to point your phpcbf preferred tool
alias phpcbf3="/home/steinkel/phpcs-cake3/vendor/bin/phpcbf --standard=CakePHP"
# gitco function
# allow commit and comment with no quotes
# adds refs #id based on current feature/issue/hotfix branch
# run phpcbf on touched files
function gitco () {
vlc --no-video-deco --no-embedded-video --screen-fps=20 --screen-top=54 --screen-left=1280 --screen-width=1920 --screen-height=980 screen://
# In my case I have dual monitors, left is 1280x1024 and I want to share my right monitor, without the top and button bar provided by xfce
# Move the new window to the left monitor and leave it in the background, not minimized
# Then start sharing using a single window and point the newly created one
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 29, 2015 at 12:12 AM
-- Server version: 5.5.40-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@steinkel
steinkel / test
Created November 17, 2017 00:44
some test
@steinkel
steinkel / gist:a8c27b47ada34cb39b739444e482c43e
Created November 17, 2017 00:52
cakefest 2017 create database and import schema
mysql -uroot -e "CREATE DATABASE my_app; CREATE DATABASE test_myapp"
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* to my_app@localhost identified by 'secret'"
curl -L https://raw.githubusercontent.com/steinkel/cakefest2017/master/schema.sql |mysql -uroot my_app