Skip to content

Instantly share code, notes, and snippets.

View stith's full-sized avatar

Anna Stith stith

View GitHub Profile
@stith
stith / AOD.patch
Created May 19, 2011 07:04
Magento 1.4.1.1 Memory Leak Patch
*** lib/Varien/Db/Select.php 2010-07-26 16:09:28.000000000 -0400
--- lib/Varien/Db/Select.php 2010-12-28 15:42:19.000000000 -0500
***************
*** 33,38 ****
--- 33,40 ----
*/
class Varien_Db_Select extends Zend_Db_Select
{
+ const TYPE_CONDITION = 'TYPE_CONDITION';
+
@stith
stith / .htaccess
Created May 6, 2011 03:41
The ultimate Magento SEO .htaccess rewrite rule set
# Grab the protocol being used
RewriteCond %{HTTPS} =on
RewriteRule ^(.+)$ - [env=ps:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.+)$ - [env=ps:http]
# Force WWW
RewriteCond %{HTTP_HOST} !^www\.
@stith
stith / engineswap.php
Created May 4, 2011 04:40
Mass MySQL storage engine updater
<?php
// Update tables from one storage engine to another
//
// Written by Matt Stith for Nexcess.net
// May 3, 2011
//
// CLI only
if (!defined('STDIN')) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# timegrep.py by Dennis Williamson 20100113
# in response to http://serverfault.com/questions/101744/fast-extraction-of-a-time-range-from-syslog-logfile
# thanks to serverfault user http://serverfault.com/users/1545/mike
# for the inspiration
# Perform a binary search through a log file to find a range of times
# and print the corresponding lines
// Info button
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
infoButton.frame = CGRectMake(290, 300, 20, 20);
[infoButton addTarget:self action:@selector(infoTapped:) forControlEvents:UIControlEventTouchUpInside];
[infoButton setEnabled:YES];
[containerView addSubview:infoButton];
[containerView bringSubviewToFront:infoButton];
@stith
stith / debug.m
Created January 3, 2011 02:12
MSLog code
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Debug
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define DEBUG_ON // Toggle to DEBUG_OFF or comment out to hide all debug code
#ifdef DEBUG_ON
#define MSLog(format, ...) CFShow([[NSString stringWithFormat:@"<%@:%d> ",[[NSString stringWithUTF8String:__FILE__] lastPathComponent],__LINE__] stringByAppendingFormat:format, ## __VA_ARGS__])
#else
#define MSlog(format, ...)
#endif
Product Names Guidelines
You may use Apple, iPad, or any other Apple word mark (but not the Apple Logo or other Apple-owned graphic symbol/logo) in a referential phrase on packaging or promotional/advertising materials to describe that the third party product is compatible with the referenced Apple product or technology, provided they comply with the following requirements.
a. The Apple word mark is not part of the product name.
b. The Apple word mark is used in a referential phrase such as "runs on," "for use with," "for," or "compatible with."
c. The Apple word mark appears less prominent than the product name.
d. The product is in fact compatible with, or otherwise works with, the referenced Apple product.
e. The reference to Apple does not create a sense of endorsement, sponsorship, or false association with Apple or Apple products or services.
f. The use does not show Apple or its products in a false or derogatory light.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name = %@",someVariableNameLol];
NSArray *filteredArray = [friends filteredArrayUsingPredicate:predicate];
@stith
stith / aasm_test.rb
Created March 4, 2010 09:52
Ruby test cases for testification
#!/usr/bin/env ruby
# Testing the aasm gem to see how to get one aasm_event to decide
# which state to transition into
require 'rubygems'
require 'aasm'
class TestObject
include AASM
aasm_initial_state :active
def allocated_date=(new_value)
write_attribute(:allocated_date, new_value) unless read_attribute(:allocated_date)
end