Skip to content

Instantly share code, notes, and snippets.

View vivianspencer's full-sized avatar

Vivian Spencer vivianspencer

View GitHub Profile
@laktek
laktek / jquery.is_blank.js
Created December 29, 2010 06:38
Checks whether the given string (or object) is blank
(function($){
$.isBlank = function(string){
return(!string || $.trim(string) === "");
};
})(jQuery);
$.isBlank(" ") //true
$.isBlank("") //true
$.isBlank("\n") //true
$.isBlank("a") //false
@maxrice
maxrice / wp-login-with-sha1-password.php
Created July 30, 2012 02:43
Allow wordpress login with sha1 password hash in database
<?php
// check if hashed password is SHA1 and update as necessary, see function comments
add_filter( 'check_password', 'check_sha1_password', 10, 4 );
/**
* Check if a user has a SHA1 password hash, allows login if password hashes match, then updates password hash to wp format
*
* Hooks into check_password filter, mostly copied from md5 upgrade function with pluggable.php/wp_check_password
*
* @param string $check
@baki250
baki250 / gist:5590680
Last active December 13, 2019 04:12 — forked from hightemp/gist:2387916

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

@t-io
t-io / osx_install.sh
Last active October 9, 2024 17:36
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@matthewpizza
matthewpizza / install-composer.sh
Created February 13, 2014 03:55
Install Composer on Webfaction
cd $HOME
ln -s `which php54` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php54
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@MurtzaM
MurtzaM / preventNonBusinessEmailSubmission.js
Created September 9, 2014 23:49
This script will prevent Marketo form submission if a user enters a non-business email (Gmail, Hotmail, etc.)
//This script prevents Marketo form submission if a user enters non-business email (Gmail, Hotmail, Yahoo, etc.)
//It will work on any page with a Marketo form, and runs when the form is ready
//For further info, please see Marketo form documentation, http://developers.marketo.com/documentation/websites/forms-2-0/
//Prepared by Ian Taylor and Murtza Manzur on 9/9/2014
<script>
(function (){
// Please include the email domains you would like to block in this list
var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];
@hans2103
hans2103 / price.phtml M1.9
Last active October 23, 2018 17:47
Implementation of structured data itemprop=price on app/design/frontend/<your_package>/<your_theme>/template/catalog/product/price.phtml - Magento 1.9.0.x - http://schema.org/Offer - more information: http://www.byte.nl/blog/magento-rich-snippets-made-easy/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@jb510
jb510 / pretty-php-date-ranges.php
Last active June 25, 2019 05:06
Pretty PHP Date Ranges
<?php
/**
* Verbose Beautified Date Range
*
* @access public
* @param mixed $start_date
* @param mixed $end_date
* @return $date_range (beautified date range)
* @license WTFPL
*

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@dancameron
dancameron / functions.php
Last active September 13, 2019 09:03
Adding String Attachments (AddStringAttachment) with wp_mail (part 2)
<?php
add_action( 'phpmailer_init', '_add_string_attachments' );
function _add_string_attachments( $phpmailer ) {
// the previous attachment will fail since it's not an actual file
// we will use the error to attach it as a string
if ( '' !== $phpmailer->ErrorInfo ) {
// error info
$error_info = $phpmailer->ErrorInfo;