Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition License
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magentocommerce.com/license/enterprise-edition
@timbroder
timbroder / Rakefile
Created September 29, 2011 02:05 — forked from stammy/Rakefile
Goes in Rakefile for Jekyll for those wanting tag pages
# Using multi-word tags support from http://tesoriere.com/2010/08/25/automatically-generated-tags-and-tag-clouds-with-jekyll--multiple-word-tags-allowed-/
# If using with jekyll gem, remove bits loop and site.read_bits('') and add require 'rubygems' and require 'jekyll'
# Using full HTML instead of layout include to manually set different page title (tag, not tag_slug) and canonical URL in header
desc 'Build tags pages'
task :build_with_tags do
sh 'rm -rf _site'
puts "Generating tags..."
@timbroder
timbroder / gist:1250743
Created September 29, 2011 13:41
endeca tunnel
ssh -L10008:8.14.113.146:10008 tbroder@time.alexanderinteractive.com
ssh -L8888 :8.14.113.146:8888 tbroder@time.alexanderinteractive.com
Then I override the hardcoded "8.14.113.146" in lib/Ai_Endeca/Endeca_SOAP.class.php with "localhost"
You can setup a similar tunnel on 8888 if you want to use the test implimentation, then you could go here:
http://localhost:8888/endeca_jspref/controller.jsp?sid=1302CF39EB83&enePort=10008&Ne=1000&eneHost=localhost&N=0
@timbroder
timbroder / hg mercurial branching
Created September 29, 2011 19:11
hg mercurial branching
hg pull
hg update
hg update default
hg merge UAT.RC12
hg commit -m "merged UAT.RC12 into default"
hg update UAT.RC12
hg commit --close-branch -m "closing branch UAT.RC12"
hg branch UAT.RC13
hg commit -m "created branch UAT.RC13"
hg push --new-branch
@timbroder
timbroder / delete wordpress posts by category
Created October 4, 2011 13:36
delete wordpress posts by category
SELECT p.post_title, p.ID, wpr.object_id, wp_terms.term_id, wp_terms.name, wp_term_taxonomy.taxonomy
FROM wp_terms
INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
INNER JOIN wp_term_relationships wpr ON wpr.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
INNER JOIN wp_posts p ON p.ID = wpr.object_id
WHERE taxonomy = 'category'
AND p.post_type = 'post'
AND p.post_status = 'publish'
AND name != 'Code'
ORDER BY object_id;
@timbroder
timbroder / wtf7.js
Created October 6, 2011 20:15
wtf7
$j.each(item.parent().parent().parent().next().children('.inner').children().children('.row').children('.details'),function(){
var qty = $j(this).children().children('.kit_qty').html();
$j(this).children().children('.kit_qty').html(json.itemsQty);
var price = $j(this).children().children('.total').children().children('.price').html();
totalSave = totalSave+((price.substr(1,price.length)/qty)*json.itemsQty);
$j(this).children().children('.total').children().children('.price').html("$"+(price.substr(1,price.length)/qty)*json.itemsQty);
});
@timbroder
timbroder / gist:1293475
Created October 17, 2011 19:06
Creating a Stateless Request in Magento 1
<?php
...
if (!$this->getFlag('', self::FLAG_NO_START_SESSION)) {
$checkCookie = in_array($this->getRequest()->getActionName(), $this->_cookieCheckActions);
$checkCookie = $checkCookie && !$this->getRequest()->getParam('nocookie', false);
$cookies = Mage::getSingleton('core/cookie')->get();
if ($checkCookie && empty($cookies)) {
$this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, true);
}
Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
@timbroder
timbroder / gist:1293491
Created October 17, 2011 19:13
Creating a Stateless Request in Magento 2
<?php
class Ai_AjaxCatalog_Controller_Action extends Mage_Core_Controller_Front_Action
{
public function preDispatch()
{
$this->setFlag('', self::FLAG_NO_START_SESSION, 1); // Do not start standard session
parent::preDispatch();
return $this;
}
}
@timbroder
timbroder / gist:1299610
Created October 19, 2011 20:46
unicorn bitches
(function(a,b){function d(a,b){return a===null?b==="null":a===undefined?b==="undefined":a.is&&a instanceof f?b==="element":Object.prototype.toString.call(a).toLowerCase().indexOf(b)>7}function c(a){var b,e,f,g,h,i,l,m,n;if(a instanceof c)return a;d(a,"array")||(a=String(a).replace(/\s/g,"").toLowerCase().match(/(?:\+,|[^,])+/g));for(b=0,e=a.length;b<e;++b){d(a[b],"array")||(a[b]=String(a[b]).match(/(?:\+\/|[^\/])+/g)),i=[],f=a[b].length;while(f--){var l=a[b][f];h={jwertyCombo:String(l),shiftKey:!1,ctrlKey:!1,altKey:!1,metaKey:!1},d(l,"array")||(l=String(l).toLowerCase().match(/(?:(?:[^\+])+|\+\+|^\+$)/g)),g=l.length;while(g--)l[g]==="++"&&(l[g]="+"),l[g]in k.mods?h[j[k.mods[l[g]]]]=!0:l[g]in k.keys?h.keyCode=k.keys[l[g]]:m=l[g].match(/^\[([^-]+\-?[^-]*)-([^-]+\-?[^-]*)\]$/);if(d(h.keyCode,"undefined"))if(m&&m[1]in k.keys&&m[2]in k.keys){m[2]=k.keys[m[2]],m[1]=k.keys[m[1]];for(n=m[1];n<m[2];++n)i.push({altKey:h.altKey,shiftKey:h.shiftKey,metaKey:h.metaKey,ctrlKey:h.ctrlKey,keyCode:n,jwertyCombo:String(l)});h.k
from Django.shortcuts import render_to_response
from gdata import service
import gdata
import atom
import getopt
import sys
from mx import DateTime