Skip to content

Instantly share code, notes, and snippets.

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ncla
ncla / dob.phtml
Last active March 17, 2021 22:09
Magento Date of Birth drop down boxes
<?php
/**
* @author iamncla @ github.com
* @see Mage_Customer_Block_Widget_Dob
*/
?>
<label for="<?php echo $this->getFieldId('month')?>"<?php if ($this->isRequired()) { echo ' class="required"'; } ?>><?php echo $this->__('Birthday') ?></label>
<div class="customer-dob">
<div class="dob-month">
<select name="<?php echo $this->getFieldName('month'); ?>" id="<?php echo $this->getFieldId('month'); ?>">
@antoinekociuba
antoinekociuba / observer.php
Last active August 29, 2015 14:04
Display out of stock options of Configurable products, depending on 'Show out of stock' system configuration setting.
<?php
/**
* Check if out of stock options of configurable products should be displayed
*/
public function checkDisplayOutOfStockOptions()
{
$currentProduct = Mage::registry('current_product');
if ($currentProduct && $currentProduct->isConfigurable()) {
if (Mage::getStoreConfigFlag(Mage_CatalogInventory_Helper_Data::XML_PATH_SHOW_OUT_OF_STOCK)) {