Skip to content

Instantly share code, notes, and snippets.

View lucassmacedo's full-sized avatar
🎯
Focusing

Lucas Macedo lucassmacedo

🎯
Focusing
View GitHub Profile
@lucassmacedo
lucassmacedo / gist:f5e3df8fc6cf6d6548d1
Last active October 8, 2015 14:08
Migrations tutorial step 2
<?php
use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;
class CartItems extends AbstractMigration {
public function up() {
$table = $this->table('cart_items');
$table->addColumn('user_id', 'integer')
@lucassmacedo
lucassmacedo / gist:5d4a4608bd751f299146
Created October 8, 2015 13:55
Migrations tutorial step 1
<?php
use Phinx\Migration\AbstractMigration;
class CreatePostsTable extends AbstractMigration {
public function up() {
$table = $this->table('posts');
$table->addColumn('title', 'string')
->addColumn('slug','string')
->addIndex(array('slug'), array('unique' => true))
$categories = $CategoryModel->find('threaded', array(
'conditions' => array(
'Category.home' => true,
'Category.visible' => true,
'Category.active' => true,
),
));
foreach ($categories as $item) {
extract($item);
@lucassmacedo
lucassmacedo / gist:144bc5a1253ba44edd1c
Created February 18, 2016 17:32
Wordpress Azkfile.js
/**
* Documentation: http://docs.azk.io/Azkfile.js
*/
// Adds the systems that shape your system
systems({
wordpress: {
// Dependent systems
depends: ['mysql'],
// More images: http://images.azk.io
image: {"docker": "azukiapp/php-fpm"},
@lucassmacedo
lucassmacedo / gist:4747cc868f57f3bfdcb7
Created February 18, 2016 17:32
Wordpress wp-config for AZK
define('DB_NAME', getenv('MYSQL_DATABASE'));
define('DB_USER', getenv('MYSQL_USER'));
define('DB_PASSWORD', getenv('MYSQL_PASSWORD'));
define('DB_HOST', getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT'));
/**
* Documentation: http://docs.azk.io/Azkfile.js
*/
// Adds the systems that shape your system
systems({
paypal: {
// Dependent systems
depends: ['mysql'],
// More images: http://images.azk.io
image: {"docker": "azukiapp/php-fpm:5.6"},
@lucassmacedo
lucassmacedo / gist:8a9d507425feef607960fc6106c5fbda
Last active May 17, 2016 18:58
Export all databases on mysql
#!/bin/bash
#Por : Lucas Macedo
#se você usar apenas usuário sem senha, use este linha abaixo
usuarioesenha="-u root -proot"
#pasta para exportação do banco
pasta_backup="/Users/Lucas/backup_banco"
#define o path do mysql, se estiver global deixe apenas "mysql" ex: C:\wamp\bin\mysql\mysql5.6.12\bin\mysql
@lucassmacedo
lucassmacedo / gist:47adf2782875b5654a2eba1c112995c6
Last active May 17, 2016 18:48
Import all databases on mysql
#!/bin/bash
#By: Lucas macedo
#Defina seu usuário e senha
usuarioesenha="-u root -proot"
#define o path do mysql, se estiver global deixe apenas "mysql" ou wamp/mamp ex: C:\wamp\bin\mysql\mysql5.6.12\bin\mysql
_mysql="/Applications/MAMP/Library/bin/mysql"
#busca todas databases
databases=(`$mysql -e "show databases" ${usuarioesenha}`)
@lucassmacedo
lucassmacedo / post-receive.sh
Last active April 28, 2017 18:43
post-receive hook for git deploy (Laravel 5)
#!/bin/sh
WEBROOT=~/laravelapp
GIT_WORK_TREE=$WEBROOT git checkout -f
#change directory to the project dir
cd $WEBROOT
# Check if a composer.json file is present
if [ -f composer.json ]; then
products:
------------------
| id | name |
------------------
| 1 | t-shirt |
------------------
variants:
------------------------------
| id | product_id | name |