Skip to content

Instantly share code, notes, and snippets.

View alihalabyah's full-sized avatar
🎯
Focusing

Ali Halabyah alihalabyah

🎯
Focusing
View GitHub Profile
@alihalabyah
alihalabyah / gist:fba4660d0d3f4c3c85a3
Last active May 9, 2017 13:10
Magento postal code javascript error: error: error in [unknown object].fireEvent(): event name: address_country_changed error message: zipElement.up(1).down("label > span.required") is undefined Fix! ___ Update file: app\design\adminhtml\default\default\template\directory\js\optional_zip_countries.phtml
<?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
# This configuration is what is provided by PageCache by Varnish for Magento module:
# http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html
# default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "80";
}
# admin backend with longer timeout values. Set this to the same IP & port as your default server.
@alihalabyah
alihalabyah / gist:8435482
Created January 15, 2014 12:40
An alternative for file_get_contents() in PHP
<?php
public function url_get_contents ($url) {
if (!function_exists('curl_init')){
die('CURL is not installed!');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
@alihalabyah
alihalabyah / gist:8423759
Created January 14, 2014 19:00
jQuery countTo plugin
<script type="text/javascript">
(function($) {
$.fn.countTo = function(options) {
// merge the default plugin settings with the custom options
options = $.extend({}, $.fn.countTo.defaults, options || {});
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(options.speed / options.refreshInterval),
increment = (options.to - options.from) / loops;
@alihalabyah
alihalabyah / gist:8285055
Created January 6, 2014 16:09
Get country name by country code - Magento
<?php
$country_name=Mage::app()->getLocale()->getCountryTranslation($country_code);
?>