Skip to content

Instantly share code, notes, and snippets.

@xr0m3oz
xr0m3oz / git-deployment.md
Created February 19, 2019 14:51 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

@xr0m3oz
xr0m3oz / Before save.php
Created May 13, 2015 14:48
Before save
/**
* Before save
*/
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
$this->status = self::STATUS_ACTIVE;
$this->api_hash =
return true;
} else {
@xr0m3oz
xr0m3oz / Google analitics.php
Last active August 29, 2015 14:20
Google analitics trecing code for (GRAVITY form ) WP plagin
add_filter("gform_submit_button_3", "add_conversion_tracking_code", 10, 2); // name of form
function add_conversion_tracking_code($button, $form) {
global $post;
$dom = new DOMDocument();
$dom->loadHTML($button);
$input = $dom->getElementsByTagName('input')->item(0);
if ($input->hasAttribute('onclick')) {
$input->setAttribute("onclick","gaTrackingEvent('".get_permalink($post->ID)."');".$input->getAttribute("onclick"));
} else {
@xr0m3oz
xr0m3oz / wp_resize.php
Created March 23, 2015 12:39
Resize on fly
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@xr0m3oz
xr0m3oz / menudb.php
Created January 15, 2015 22:02
menu from db
//in view
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => MyMenuModel::getItems(),
]);
//in model
public static function getItems()
{
@xr0m3oz
xr0m3oz / yii.php
Created December 29, 2014 17:48
error yii 2 update
$ composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
@xr0m3oz
xr0m3oz / enum_migration_yii2.php
Created December 15, 2014 21:32
yii2 migration enum
'show' => 'ENUM(`yes`, `no`) NOT NULL DEFAULT `yes`',
@xr0m3oz
xr0m3oz / pagination_yii2.php
Created December 15, 2014 09:25
Pagination yii2
namespace app\controllers;
use yii\web\Controller;
use yii\data\Pagination;
use app\models\Country;
class CountryController extends Controller
{
public function actionIndex()
{
$query = Country::find();
$pagination = new Pagination([
<?php
$d = new DateTime( '2010-01-31' );
$d->modify( 'first day of next month' );
echo $d->format( 'F' ), "\n";
?>
Options +FollowSymLinks IndexIgnore */* RewriteEngine on   # Если запрос начинается с /admin, то заменяем на /backend/web/ RewriteCond %{REQUEST_URI} ^/admin RewriteRule ^admin\/?(.*) /backend/web/$1   # Добавляем другой запрос /frontend/web/$1 RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin) RewriteRule (.*) /frontend/web/$1   # Если frontend запрос RewriteCond %{REQUEST_URI} ^/frontend/web RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /frontend/web/index.php   # Если backend запрос RewriteCond %{REQUEST_URI} ^/backend/web RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /backend/web/index.php