Skip to content

Instantly share code, notes, and snippets.

@reesmcivor
reesmcivor / truncate-words
Last active August 29, 2015 13:56
Truncate Words
<?php
/**
* Truncate string
* --------------------------------------------------------------------------------------------
* @param str string subject to truncate
* @param len integer length of the string after being stripped from tags if true
* @param ending string concatinate $ending if the string has been truncated
* @param bStripTags bool strip the html tags from string
*/
function truncate($str, $len = 120, $ending = '...', $bStipTags = true, $bnl2br = true) {
@reesmcivor
reesmcivor / README.md
Created November 27, 2013 12:38 — forked from oodavid/README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
/**
* Add ordered qty', but only simple products
*
* @param string $from
* @param string $to
* @return Mage_Reports_Model_Resource_Product_Collection
*/
public function addOrderedQty($from = '', $to = '')
{
$adapter = $this->getConnection();
@reesmcivor
reesmcivor / gist:3858456
Created October 9, 2012 12:17 — forked from davidalexander/gist:1086455
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@reesmcivor
reesmcivor / wordpress_json_posts
Created August 20, 2012 10:15
wordpress_json_posts
<?php
// include our wordpress functions
// change relative path to find your WP dir
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
// set header for json mime type
header('Content-type: application/json;');
@reesmcivor
reesmcivor / git-workflow
Created May 20, 2012 20:14
GIT Workflow
Design/Integration & Development Workflow
-------------------------------------------------
Local (localhost on every machine or remote VM's)
------------------------------------------------------
- I think we should start off with xampp or wamp as our environment, as this will be faster to setup on peoples machines.
- The databases on the development server are mimiced on the office server and can be taken/synced at any time.
Development Server (The working application at all times so the client can edit db and navigate around the site without issues)