Skip to content

Instantly share code, notes, and snippets.

@gibbs
gibbs / currency_symbols.php
Last active April 3, 2024 10:09
An array of currency symbols as HTML entities
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
@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 / 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");
@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());
@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';
#! /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 / 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 / drupal_current.php
Created April 10, 2013 12:55
Get the installed version of Drupal
<?php
/**
* Get Drupal 7 current version
*/
$version = NULL;
$version_file = 'includes/bootstrap.inc';
// Path to installation
$install_path = '/home/user/website.com/public_html';