This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('show_admin_bar', 'pods_admin_bar_displaying'); | |
/** | |
* Checks if the admin bar is being displayed for current user. | |
* | |
* @global bool $podsAdminBarEnabled | |
* @param bool $currentStatus | |
* @return bool | |
*/ | |
function pods_admin_bar_displaying($currentStatus) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('widgets_init', 'pods_register_widgets'); | |
/** | |
* Register any/all pods widgets with wordpress. | |
*/ | |
function pods_register_widgets() { | |
register_widget('Pods_Custom_Widget'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('CACHE_DURATION', 1800); // 30 mins | |
define('PODS_CACHE_GROUP', 'pods_plugin'); | |
// Example of pods->find() method with database caching | |
public function find ($params, $limit = 15, $where = null, $sql = null) { | |
// Cache key is combo of current pod id, and query string of arguments | |
// May want to prefix with pods_plugin? | |
$findPodCacheKey = $this->id . http_build_query(array($params, $limit, $where, $sql)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
import os, commands | |
import json, re | |
import pprint | |
""" TODO: | |
- have settings file with username/password/additional flags? | |
- options menu, per file/folder commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ "keys": ["shift+alt+a"], | |
"command": "subversion", | |
"args": { | |
"svn_command": "add", | |
"on_file": "False" | |
} | |
}, | |
{ "keys": ["shift+alt+c"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function _prepareCollection() | |
{ | |
$collection = Mage::getResourceModel($this->_getCollectionClass()); | |
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),'sfoa.entity_id=main_table.entity_id',array('sfoa.postcode')); | |
$this->setCollection($collection); | |
return parent::_prepareCollection(); | |
} | |
protected function _prepareColumns() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SLAVE_DB_USER="foo" | |
SLAVE_DB_PASS="bar" | |
SLAVE_DB_NAME="foobar" | |
SLAVE_DB_HOST="127.0.0.1" | |
MASTER_DB_USER="production_foo" | |
MASTER_DB_PASS="foobarbaz" | |
MASTER_DB_NAME="production" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void _removeNodeFromLinkedList(Node toBeRemoved) { | |
Node previousNode = null; | |
Node nextNode = this.pFirst.pNext; | |
for (Node currentNode = this.pFirst; currentNode != null; currentNode = currentNode.pNext) { | |
if (currentNode == toBeRemoved) { | |
// We need to remove the first from the linked list | |
if (currentNode == this.pFirst) { | |
// Set the next node (second) to be pFirst | |
this.pFirst = nextNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Specifically getting catalog_url indexer, returns Mage_Index_Model_Process | |
$catalog_url_rewrite_process = Mage::getSingleton('index/indexer')->getProcessesCollection() | |
->addFieldToFilter('indexer_code', 'catalog_url') | |
->getFirstItem(); | |
// Can use reindexAll(), or reindexEverything which checks dependencies, and returns reindexAll() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
from fabric.context_managers import hide | |
from fabric.operations import local, put, prompt, get | |
from time import time | |
import json | |
import os | |
import re | |
import sys | |
from string import strip |
OlderNewer