Skip to content

Instantly share code, notes, and snippets.

@gibbs
gibbs / move-drupal7-non-core
Created April 30, 2015 22:47
Move non-core drupal modules example
find . -maxdepth 1 -type d \
-not -iname "." \
-and -not -iname "aggregator" \
-and -not -iname "block" \
-and -not -iname "blog" \
-and -not -iname "book" \
-and -not -iname "color" \
-and -not -iname "comment" \
-and -not -iname "contact" \
-and -not -iname "contextual" \
@gibbs
gibbs / magento-country-codes
Created August 7, 2014 19:58
Magento Country Codes
AF - Afghanistan
AL - Albania
DZ - Algeria
AS - American Samoa
AD - Andorra
AO - Angola
AI - Anguilla
AQ - Antarctica
AG - Antigua and Barbuda
AR - Argentina
@gibbs
gibbs / modx-markitup.json
Created July 12, 2014 19:06
MODX MarkItUp extension JSON for Markdown editing
{
nameSpace : "resourceEditor",
onShiftEnter : {
keepDefault : false,
replaceWith : '<br />\n'
},
onCtrlEnter : {
keepDefault : false,
openWith : '\n',
closeWith : '\n'
@gibbs
gibbs / magento-base-images.php
Created June 13, 2014 12:54
Magento - Set all product images to small, base and thumbnail
<?php
require 'app/Mage.php';
Mage::app();
$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
foreach ($products as $product) {
if (!$product->hasImage()) continue;
if (!$product->hasSmallImage()) $product->setSmallImage($product->getImage());
if (!$product->hasThumbnail()) $product->setThumbnail($product->getImage());
#! /usr/bin/python
import gtk
try:
import egg.trayicon
except:
print "You need to install the python-eggtrayicon package"
class EggTrayIcon:
def __init__(self):
"""
Quick Linux DNS IP Updater Python script for FreeDNS (freedns.afraid.org)
Author: Daniel Gibbs
Version: 0.2
URL: http://www.danielgibbs.net/
** Must set update_key and make sure that ip_file is read and writable
This program is free software; you can redistribute it and/or modify it under
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>YouTube</ShortName>
<Description>YouTube Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD///8AEiP//xIj//8SI///EyP//xIj//8SI///EiP//xIj//8SI///EyP//xIj//8SI///EiP//xIj//////8AEiP//wAc7v8AHO7/AB3v/wAc7v8AHO7/ABzu/wAc7v8AHO7/ABzu/wAd7/8AHe//ABzu/wAc7/8AHe//EiP//xIj//8SI////////09V//+6uv////////////9PVf//z87///////+ysv//EiP//5ub////////0tH//xIj//8SI///EiP///////9PVf///////xIj////////T1X///////8SI////////5qZ////////EiP//xIj//8TI///EiP//xIj////////T1X///////8TI////////09V////////EiP///////+amf/////////////S0f//EiP//xIj//8SI////////09V////////EiL///////9PVf////////////+6uv//EiP//7q6///v8P//0tH//xIj//8SI///EyP///////8SI///EiP//xIj//8SI///EiP///////8SI///EiP//xIj//8SI///EiP//xIj//8SI///EiP//////////////////xIj//8SI///EiP//xMj////////EiP//xIj//8SI///EiP//xIj//8SI///EiP//9nZ//8SI///EiP//xMj//8SI
@gibbs
gibbs / http_status_codes.php
Created October 27, 2013 13:48
HTTP status codes array
<?php
$code = array();
$code['0'] = 'Connection Failed. Please configure Varnish to accept HTTP purge requests.';
$code['100'] = 'Continue';
$code['101'] = 'Switching Protocols';
$code['102'] = 'Processing';
$code['200'] = 'OK';
$code['201'] = 'Created';
$code['202'] = 'Accepted';
@gibbs
gibbs / clear_modx_cache_2.0.php
Created October 27, 2013 13:44
Refresh / clear the MODx Revolution (2.0.*) cache
<?php
/*
* Clear (refresh) MODx Cache from external PHP Script
*
* MODx Revolution (2.0.7-pl)
* Daniel Gibbs
*/
// Path to MODx Core Directory
define("MODX_CORE_PATH", "../core/");
@gibbs
gibbs / clear_modx_cache_2.1.php
Last active November 13, 2018 17:18
Refresh / clear the MODX Revolution 2.1+ cache
<?php
// Dan Gibbs
// Clear MODx Revolution Cache (2.1 and later)
// Path to MODx Core Directory
define("MODX_CORE_PATH", "../core/");
define("MODX_CONFIG_KEY", "config");
// Include MODx main class
include(MODX_CORE_PATH . "model/modx/modx.class.php");