Skip to content

Instantly share code, notes, and snippets.

@lideo
lideo / starter-html.html
Created June 22, 2014 10:15
Simple HTML starter template
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
@lideo
lideo / gist:506952261f8417a8c127
Last active August 29, 2015 14:08
OSX Yosemite + Chrome 38: "Save as..." dialog is too big.
Run the following commands in the terminal:
defaults delete com.google.Chrome NSNavPanelExpandedSizeForOpenMode
defaults delete com.google.Chrome NSNavPanelExpandedSizeForSaveMode
@lideo
lideo / start-simplehttpserver
Last active August 29, 2015 14:10
Start a Simple Web Server from Any Directory on Your Mac
http://lifehacker.com/start-a-simple-web-server-from-any-directory-on-your-ma-496425450
python -m SimpleHTTPServer 8000
@lideo
lideo / gist:5ea95fa42f39b76ec77a
Created November 29, 2014 17:42
Magento: get raw value of a product attribute.
Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);
@lideo
lideo / gist:54ba221c4adad92c1b8d
Created November 30, 2014 09:35
Symfony2 server run
php app/console server:run
@lideo
lideo / ip2country.php
Created December 18, 2014 18:28
IP2Country
<?php
$service_url = 'http://ipinfo.io/8.8.8.8/json';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
@lideo
lideo / gist:aab77278be3da6d56799
Created December 18, 2014 20:08
Switch windows in Chrome + Mac OS X (Spanish ISO keyboard)
cmd + `
cd ~/Downloads
curl -O http://www.magentocommerce.com/downloads/assets/1.8.1.0/magento-1.8.1.0.tar.gz
curl -O http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
tar -zxvf magento-1.8.1.0.tar.gz
mv ~/Downloads/magento-1.8.1.0 ~/Sites/magento
tar -zxvf magento-sample-data-1.6.1.0.tar.gz
mv magento-sample-data-1.6.1.0/media/* ~/Sites/magento/media/
mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql ~/Sites/magento/data.sql
cd ~/Sites
mv magento/* magento/.htaccess magento
@lideo
lideo / gist:e4fba44f3ed3a263bd4e
Created January 23, 2015 18:24
Compress to ZIP
zip -r -X archive_name.zip folder_to_compress
“-X” removes invisible Mac resource files such as “_MACOSX” or “._Filename” and .ds store files
@lideo
lideo / gist:41a6de38d73e83dd5de3
Created June 28, 2015 10:00
Password protect a page with PHP
if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != 'username' || $_SERVER['PHP_AUTH_PW'] != 'password') {
header('WWW-Authenticate: Basic realm="MyProject"');
header('HTTP/1.0 401 Unauthorized');
die('Access Denied');
}