Skip to content

Instantly share code, notes, and snippets.

@philwinkle
philwinkle / waste.php
Last active October 6, 2021 21:00
Waste fixed amount of memory in PHP
<?php
/**
* Yeah yeah yeah, as if we need this, right?
* @author Phillip Jackson <philwinkle@gmail.com>
* @twitter philwinkle
*/
function waste($size){
$initSize = memory_get_usage();
var cornify_count = 0;
var cornify_add = function() {
cornify_count += 1;
var cornify_url = 'http://www.cornify.com/';
var div = document.createElement('div');
div.style.position = 'fixed';
var numType = 'px';
var heightRandom = Math.random()*.75;
var windowHeight = 768;
@philwinkle
philwinkle / day.css
Last active March 25, 2021 03:24
Day and Night CSS files for Chris Harry jQuery lesson testing in jsFiddle. For more context see http://jsfiddle.net/87Nzy/1/
body {
background-color: yellow;
color: #000;
}
@philwinkle
philwinkle / end_of_the_road.js
Created December 19, 2013 20:19
Bookmarklet to add Boyz II Men's "End of the Road" to any webpage
javascript:(function(){var iframe='<iframe width="640" height="360" src="//www.youtube.com/embed/zDKO6XYXioc?feature=player_detailpage&autoplay=1" frameborder="0" allowfullscreen style="position: fixed; top: 0; left: 0; z-index: 999;"></iframe>';var bodyElement = document.body;bodyElement.innerHTML = iframe + bodyElement.innerHTML;})();
@philwinkle
philwinkle / SassMeister-input-HTML.html
Created August 27, 2014 14:47
Generated by SassMeister.com.
<a href="#" class="button">Obnoxious button</a>
🏃. 5x Magento Certified, 2x Magento Master. ✝ Follower. Co-host @magetalk,@commercefuture. Organizer @magentosofla. Evangelist @somethingdigitl
@philwinkle
philwinkle / ce-1.6.2.0\app\code\core\Mage\Usa\Model\Shipping\Carrier\Fedex.php
Last active October 7, 2016 00:38
Git diff of Fedex SOAP API endpoint change - CE 1.6, 1.7, 1.8 and EE 1.11, 1.12, 1.13
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
index d567b6e..9a98440 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
@@ -119,8 +119,8 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex
{
$client = new SoapClient($wsdl, array('trace' => $trace));
$client->__setLocation($this->getConfigFlag('sandbox_mode')
- ? 'https://wsbeta.fedex.com:443/web-services/rate'
- : 'https://ws.fedex.com:443/web-services/rate'
<?php
/**
* A simple fix for a shell execution on preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
* The only edit that was done is that shell_exec('mysql -V') was changed to mysql_get_server_info() because not all
* systems have shell access. XAMPP, WAMP, or any Windows system might not have this type of access. mysql_get_server_info()
* is easier to use because it pulls the MySQL version from phpinfo() and is compatible with all Operating Systems.
* @link http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
* @author Magento Inc.
*/
@philwinkle
philwinkle / reproduce.md
Last active February 24, 2016 08:42
product->load as an antipattern?
<?php

require('app/Mage.php');
Mage::app();


$product = Mage::getModel('catalog/product')->getCollection()->getFirstItem();

var_dump($product-&gt;getData('media_gallery'));
@philwinkle
philwinkle / Philwinkle\Module\Helper\Data.php
Last active December 28, 2015 22:19
**Edited 4/19/14** see http://blog.philwinkle.com/updates-in-magento-2/ || [Quickcast] Magento Module creation part 4. Part 4 of our ongoing series. We dive into the new dependency injection pattern in Magento 2 by creating and then referring to a helper in the module we created in parts 1-3.Link: http://quick.as/bbpzf6e4
<?php
namespace Philwinkle\Module\Helper;
class Data extends \Magento\Core\Helper\Data
{
public function l33t($string)
{
return strtr($string, 'leto', '1370');
}