Skip to content

Instantly share code, notes, and snippets.

View carlowens's full-sized avatar

Carl Owens carlowens

View GitHub Profile
@carlowens
carlowens / gist:62d1e07c8d8f29f9957b00355356f976
Created February 9, 2017 22:31
linux foxus / hide terminator shortcut key command
/usr/bin/xdotool search --onlyvisible --class terminator windowactivate
/usr/bin/xdotool search --onlyvisible --class terminator windowminimize
@carlowens
carlowens / Magento2-remove-orders-customers
Created November 14, 2016 11:24
Magento 2 remove test data of orders and customers
SET FOREIGN_KEY_CHECKS = 0;
#clear orders
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;
@carlowens
carlowens / gist:0de961b86477488be83417ba09b44bae
Created November 2, 2016 14:59
compression & cache headers nginx
server {
gzip on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
#it was gzip_buffers 16 8k;
gzip_buffers 128 4k; #my pagesize is 4
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
@carlowens
carlowens / gist:ce29010cd69494a5bf5c061857cd0a88
Created October 24, 2016 11:12
apache 2.4 add expires headers and compression
a2enmod expires
-----------------
ExpiresActive on
# send an Expires: header for each of these mimetypes (as defined by server)
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
@carlowens
carlowens / nginx-vhost.conf
Last active May 3, 2017 06:33
nginx geoip redirect for magento 1
###########START of redirect updates based on geoip########
set $condition '';
set $redirect_uri '';
set $my_cookie '';
if ($cookie_store) {
set $condition 'cookie';
}
set $country 'none';
if ($http_CF_IPCOUNTRY) {
@carlowens
carlowens / gist:2e5eeb434a8d2d1297f3
Last active August 29, 2015 14:17
VM run php command with no memory limit
php -d memory_limit=-1 composer.phar update
@carlowens
carlowens / router.php
Last active August 29, 2015 14:11 — forked from tamagokun/router.php
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
set_include_path(get_include_path().':'.__DIR__);
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';
@carlowens
carlowens / gist:78180b06cb2ee5b95eaf
Created October 23, 2014 23:04
wordpress sql update domain
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost:8888/', 'http://somesite.local/') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://localhost:8888/', 'http://somesite.local/');
UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost:8888/', 'http://somesite.local/');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://localhost:8888/', 'http://somesite.local/');
#
# deb cdrom:[Ubuntu-Server 14.04 LTS _Trusty Tahr_ - Release amd64 (20140416.2)]/ trusty main restricted
#deb cdrom:[Ubuntu-Server 14.04 LTS _Trusty Tahr_ - Release amd64 (20140416.2)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.digitalocean.com/ubuntu/ trusty main restricted
deb-src http://mirrors.digitalocean.com/ubuntu/ trusty main restricted

PhpSpec 2.0 Cheat Sheet

Object: $result ($this)

Expectation: should or shouldNot

Matcher: Be...()

Types of Matchers: