Skip to content

Instantly share code, notes, and snippets.

@mclevenger
mclevenger / Abstract.php
Created November 22, 2012 05:36
Magento Overrride with patch for fixing the db deadlock error issue
Magento Overrride with patch for fixing the db deadlock error issue
FILE PATH:
/var/www/dev.linentablecloth.com/app/code/local/Mage/Sales/Model/Abstract.php
SOURCE CODE:
<?php
/**
@sunix
sunix / scantofile.sh
Created August 5, 2012 08:49
My Brother brscan scanner S-KEY tool scan to file script. Scan from ADF, convert to PDF and merge PDFs files into a single one.
#! /bin/sh
set +o noclobber
#
# $1 = scanner device
# $2 = friendly name
#
#
# 100,200,300,400,600
#
@chrisbloom7
chrisbloom7 / longest_common_substring.php
Created June 12, 2011 03:27
Find the longest common substring in an array of strings (PHP)
<?php
function longest_common_substring($words)
{
$words = array_map('strtolower', array_map('trim', $words));
$sort_by_strlen = create_function('$a, $b', 'if (strlen($a) == strlen($b)) { return strcmp($a, $b); } return (strlen($a) < strlen($b)) ? -1 : 1;');
usort($words, $sort_by_strlen);
// We have to assume that each string has something in common with the first
// string (post sort), we just need to figure out what the longest common
// string is. If any string DOES NOT have something in common with the first
// string, return false.