Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Created by PhpStorm.
* User: ciba
* Date: 07.07.16
* Time: 11:40
*/
namespace App\Support\Banks\Drivers;
server {
...
server_name dev-site.com
location ~ ^/(uploads|media|common)/ {
if (-f $request_filename) {
break;
}
rewrite ^(.*)$ http://production-site.com$1 permanent;
}
...
<?php
class Article_model extends MY_Model{
//should i kept it before OR after ?
public $before_delete = array( 'delete_timestamps' );
protected $soft_delete = TRUE;
//my column name is deleted_by such case still i have to mentioned or its optional
protected $deleted_by_key = 'deleted_by';
protected function delete_timestamps($where)
{
@michail1982
michail1982 / Database.php
Created March 11, 2015 00:37
Twig_Loader_Database
<?php
class Twig_Loader_Database implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
const MAIN_NAMESPACE = '__main__';
protected $templates = array();
/**
@michail1982
michail1982 / Hmvc.php
Created March 10, 2015 10:09
Twig_Loader_Hmvc
<?php
/**
* Loads template from the HMVC.
* Initialize
* $loader = new Twig_Loader_Hmvc(APPPATH.'views');
*
* @author Michail Maksarov <michail1982@gmail.com>
*/
class Twig_Loader_Hmvc extends Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
@michail1982
michail1982 / .htaccess
Last active August 29, 2015 14:09
force Add trailing slash to uri
#Add Trailing slash
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
@michail1982
michail1982 / image_cacher
Created November 14, 2014 11:01
Cache images from other domain
/*
.htaccess
#UTIL REWRITES
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^common/img/(.*)$ /utils/cacher.php?url=https://example.com/common/img/$1 [L]
*/
$url = $_GET['url'];
$filename = dirname(dirname(__FILE__)).parse_url($url, PHP_URL_PATH);
$pathname = substr($filename, 0, strrpos($filename, '/'));
if(!is_dir($pathname)) {
@michail1982
michail1982 / DataTable.saveState.js
Created September 11, 2014 22:46
DataTable save params in query string for share
/*! DataTables Query string integration
* ©2014 Michail1982 - datatables.net/license
*/
/**
* DataTables integration get and save params in query string.
*
* This file sets the defaults and adds options to DataTables to get and save params in query string.
*/
(function(window, document, undefined) {
<?php
require_once SYSDIR . '/core/Model.php';
/**
* CREATE tree (
* pk INT(10) NOT NULL AUTO_INCREMENT,
* lft INT(10) NOT NULL DEFAULT 0,
* rgt INT(10) NOT NULL DEFAULT 0,
* PRIMARY KEY pk,
* INDEX left_key (lft, rgt)
@michail1982
michail1982 / gist:4261344
Created December 11, 2012 19:31
CodeIgniter .htacess
#-------------------------------------------------------------------------------
# CodeIgniter .htaccess file for the main index.php directory
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# If you must have your CI "system" directory at http://www.domain.tld/system/,
# Then I advise you to place a .htaccess file in that directory
# with "deny from all" in it.
#-------------------------------------------------------------------------------