Skip to content

Instantly share code, notes, and snippets.

View astorm's full-sized avatar

Alana Storm astorm

View GitHub Profile
@astorm
astorm / gist:5429158
Last active December 16, 2015 11:39
jPlayer Recursive `play` Call

Per the other comments in this thread, I was able to reproduce your problem on my 10.6.8 Mac running Chrome 25.0.1364.172.

I was able to get the player running by using the following code

p = $("#jquery_jplayer_1");
p.jPlayer("play",NaN);

Or, if you want to give up completely you can just trigger a click on the play button.

$('.jp-play').trigger('click');

@astorm
astorm / Magento 1.8 CE Alpha 1 Reindex Problem with Sample Data.markdown
Created April 26, 2013 07:02
A PHP exception being thrown by the new Magento 1.8 CE Alpha (with sample data) during `catalog_url` reindexing.

Running the catalog_url index process with a freshly installed Magento 1.8 CE Alpha 1 using the 1.6 sample data.

$ php shell/indexer.php --reindex catalog_url
Catalog URL Rewrites index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-sony-vaio-vgn-txn27n-b-11-1-notebook-pc' for key 'UNQ_CATALOG_PRODUCT_ENTITY_URL_KEY_STORE_ID_VALUE'' in /path/to/magento1point8alpha1.dev/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /path/to/magento1point8alpha1.dev/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /path/to/magento1point8alpha1.dev/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /path/to/magento1point8alpha1.dev/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)

#3 /path/to/magento1point8alpha1.dev/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)

@astorm
astorm / gist:5479072
Last active December 16, 2015 18:39
Why do some Magento extensions "grab" the initial system->configuration page away from the General tab?

So, in the class

app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php

There's the following loop in the initTabs method.

foreach ($sections as $section) {            
    Mage::dispatchEvent('adminhtml_block_system_config_init_tab_sections_before', array('section' => $section));
    $hasChildren = $configFields->hasChildren($section, $websiteCode, $storeCode);
@astorm
astorm / gist:5543492
Created May 8, 2013 20:41
Two markdown samples for a Tumblr bug.

The following (long) markdown text post get munged by tumblr.

*This article is part of <a href="http://magento-quickies.tumblr.com/tagged/n98magerun">a longer series</a> covering the <a href="https://github.com/netz98/n98-magerun">n98-magerun power tool</a>*

Now that <a href="http://magento-quickies.tumblr.com/post/49122097133/n98-magerun-development-environment">we've got a build environment up and running</a>, we can get to work creating our first `n98-magerun` command.  Our end goal for today is to add a `helloworld` command to `n98-magrun`

    $ ./n98-magerun.phar list
    
    //...
@astorm
astorm / gist:5566547
Created May 13, 2013 06:44
Magento Connect Bookmarklet
<a href="javascript:var url = 'http:' + document.getElementsByTagName('body')[0].innerHTML.match(/.extensionKey20..+?connect20\.magentocommerce\.com.+?\u0022/)[0].split('http:').pop().split('\\').join('').replace(/\u0022/,'');var field = document.createElement('input');void(field.setAttribute('type','text'));void(field.setAttribute('id','text'));void(field.setAttribute('value',url));void(field.setAttribute('style','width:100%;font-size:24px;position:relative;top:0'));void(document.body.insertBefore(field, document.body.childNodes[0]));">Connek Key</a>
<?php
/**
* Copyright © Pulsestorm LLC: All rights reserved
*/
class Yournamespace_Commercebug_Model_Ison extends Varien_Object
implements Yournamespace_Commercebug_Model_Interface_Ison
{
/**
* Commerce Bug calls this methed to determine if it should
<link rel="stylesheet" type="text/css" media="all" href="http://www.magento2.dev/pub/static/frontend/magento_blank/en_US/Magento_Widget/widgets.css" />
<link rel="stylesheet" type="text/css" media="all" href="http://www.magento2.dev/pub/static/frontend/magento_blank/en_US/Magento_Catalog/widgets.css" />
<link rel="stylesheet" type="text/css" media="all" href="http://www.magento2.dev/pub/static/frontend/magento_blank/en_US/Magento_Reports/widgets.css" />
<link rel="stylesheet" type="text/css" media="all" href="http://www.magento2.dev/pub/static/frontend/magento_blank/en_US/css/styles.css" />
@astorm
astorm / gist:6919733
Created October 10, 2013 14:54
Description of how Magento normalized cache tag case using `strtoupper`

The getCache method

#File: app/code/core/Mage/Core/Model/App.php
public function getCacheInstance()
{
    if (!$this->_cache) {
        $this->_initCache();
    }
    return $this->_cache;

}

@astorm
astorm / gist:7800119
Created December 5, 2013 04:30
A method to make the most careful of system designers weep.
protected function _getProtectedPropertyFromObject($property, $object)
{
$r = new ReflectionClass($object);
$p = $r->getProperty($property);
$p->setAccessible(true);
return $p->getValue($object);
}

It's been 9 years since the release of PHP, but my muscle memory still wants a double beat (as opposed to tripple) when I type function definitions.

class Baz
{
    function getSomething()
    {
    }

}