Skip to content

Instantly share code, notes, and snippets.

View carlowens's full-sized avatar

Carl Owens carlowens

View GitHub Profile
@carlowens
carlowens / remove-branches.sh
Created June 4, 2013 16:10
Delete unwanted git branches from remote
#!/bin/bash
echo "Deleting remote branches contained within to-be-deleted-branches.txt"
while read BRANCH_NAME
do
echo -e "$BRANCH_NAME \n"
if [ ! -L "${BRANCH_NAME}" ]; then
git push origin --delete $BRANCH_NAME
fi
done < to-be-deleted-branches.txt
@carlowens
carlowens / track-branches.sh
Last active July 16, 2019 05:26
track all remote branches from github
#!/bin/bash
echo "Tracking all remote branches"
for remote in `git branch -r | sed "s/origin\///g"`;
do git branch --track $remote origin/$remote;
done
@carlowens
carlowens / gist:7386157
Created November 9, 2013 14:39
Remove customer data, sales data and logs from Magento database
SET FOREIGN_KEY_CHECKS=0;
-- Here's where we reset the orders
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;

PhpSpec 2.0 Cheat Sheet

Object: $result ($this)

Expectation: should or shouldNot

Matcher: Be...()

Types of Matchers:

#
# 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
@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/');
@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: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 / 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: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"