Skip to content

Instantly share code, notes, and snippets.

View frugan-dev's full-sized avatar
🍎
VegDev

Frugan frugan-dev

🍎
VegDev
View GitHub Profile
<?php
/**
* GD Watermark Lib Plugin Definition File
*
* This file contains the plugin definition for GD Watermark
* Usage:
* <?php
* require_once 'path/to/ThumbLib.inc.php';
* $pic = PhpThumbFactory::create('path/to/pic/destination');
* $watermark = PhpThumbFactory::create('path/to/watermark/destination');
# compress the code
php_value auto_prepend_file ./prepend.php
php_value auto_append_file ./append.php
@frugan-dev
frugan-dev / auth-vhost.conf
Created November 3, 2015 11:43 — forked from sobstel/auth-vhost.conf
Passing HTTP AUTH BASIC/DIGEST headers from Apache to PHP-FPM
<VirtualHost *>
ServerName auth.dev
DocumentRoot "/var/www/auth"
ProxyPassMatch ^(/.*\.php)$ fcgi://127.0.0.1:9000/var/www/auth
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</VirtualHost>
@frugan-dev
frugan-dev / middleware.php
Created November 22, 2015 22:36
Silex minify HTML middleware
<?php
$app->after(function (Request $request, Response $response) use ($app) {
if ($app['debug']) {
return;
}
if (0 === strpos($response->headers->get('Content-Type'), 'text/html')) {
$search = array('/\n/','/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s');
$replace = array(' ','>','<','\\1');
@frugan-dev
frugan-dev / bootstrap_various_fixes.less
Last active April 24, 2016 11:35
Bootstrap various fixes
.alert {
.fancybox-inner & {
margin-bottom: 0;
}
.media {
margin-top: 0;
//FIXED width:10000px
@frugan-dev
frugan-dev / flush.php
Created May 5, 2016 10:01 — forked from agarzon/flush.php
PHP Flush Output
<?php
@ini_set('zlib.output_compression', 0);
@ini_set('output_buffering', 0);
@ob_end_clean();
ob_implicit_flush(true);
for($i=0; $i<10; $i++){
echo $i;
@frugan-dev
frugan-dev / dump.sh
Created May 11, 2016 22:36 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@frugan-dev
frugan-dev / install-pre-commit.sh
Created June 21, 2016 17:57 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This script will install a Git pre-commit hook that stop accidental commits to master and develop branches.
# There is also a variant that includes a core.whitespace check. See pre-commit-2 below.
# Install in current Git repo:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh
# Install with core.whitespace check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-2
# Install with core.whitespace check and EOF-newline-check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-3
# Install only core.whitespace check:
@frugan-dev
frugan-dev / composer.json
Created October 10, 2016 23:26
Zend Config Factory with preserveNumericKeys and operator params
{
"name": "root/zend-config-operator",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ewake/zend-config"
}
],
"require": {
"zendframework/zend-config": "dev-master",
@frugan-dev
frugan-dev / composer.json
Last active October 16, 2018 11:14
Wordpress action for multipart email with wp_mail function
{
"require": {
"soundasleep/html2text": "~0.3"
}
}