Skip to content

Instantly share code, notes, and snippets.

View kbariotis's full-sized avatar
🌏

Kostas Bariotis kbariotis

🌏
View GitHub Profile
@kbariotis
kbariotis / magedump.php
Created June 29, 2014 19:56
quick and dirt PHP script to dump/restore Magento DB and change Domain
<?php
/* IGNORE_TABLES */
$tablesToBeIgnored = array (
"dataflow_batch_export",
"dataflow_batch_import",
"log_customer",
"log_quote",
"log_summary",
"log_summary_type",
@kbariotis
kbariotis / install-mage.php
Created May 25, 2014 16:10
Magento installation from CLI
php install.php --license_agreement_accepted "yes" --locale "en_US" --timezone "Europe/Athens" --default_currency "EUR" --db_host "localhost" --db_name "magento19" --db_user "root" --session_save "db" --admin_frontname "admin" --url "http://localhost/magento1.9/" --use_rewrites "yes" --use_secure "yes" --secure_base_url "http://localhost/magento1.9/" --use_secure_admin "no" --admin_firstname "John" --admin_lastname "Smith" --admin_email "john.smith@widgets.com" --admin_username "admin" --admin_password "mag3nto"
@kbariotis
kbariotis / .gitignore
Last active January 17, 2017 08:13
.gitignore for Magento 1.8
app/code/community/Phoenix/
app/code/community/Cm/
app/code/core/
app/design/adminhtml/default/default/
app/design/frontend/base/
app/design/frontend/default/blank/
app/design/frontend/default/default/
app/design/frontend/default/iphone/
app/design/frontend/default/modern/
app/design/frontend/enterprise/default
@kbariotis
kbariotis / grid.less
Last active August 29, 2015 14:00
Minimal Fluid Grid with LESSCSS
.grid_1 { width:7.5833333333333333333333333333333%; }
.grid_2 { width:15.166666666666666666666666666667%; }
.grid_3 { width:22.75%; }
.grid_4 { width:30.333333333333333333333333333333%; }
.grid_5 { width:37.916666666666666666666666666667%; }
.grid_6 { width:45.5%; }
.grid_7 { width:53.083333333333333333333333333333%; }
.grid_8 { width:60.666666666666666666666666666666%; }
.grid_9 { width:68.25%; }
.grid_10 { width:75.833333333333333333333333333333%; }
@kbariotis
kbariotis / build.xml
Created March 17, 2014 18:54
Phing .xml for generating empty Magento Modules.
<?xml version="1.0" ?>
<project name="MagentoExt" basedir="." default="MagentoExt">
<!-- Properties -->
<property name="module.name" value="NAMESPACE" />
<property name="package.name" value="MODULENAME" />
<property name="package.scope" value="local" /><!-- local/community -->
<!-- Basic Folder and Files Structure Creation -->
<target name="MagentoExt" description="">
@kbariotis
kbariotis / build.xml
Created March 8, 2014 13:03
Phing build.xml boilerplate
<?xml version="1.0" encoding="UTF-8"?>
<project name="HelloWorld" default="welcome" basedir="." description="a demo project">
<property name="message" value="Hello World!"/>
<property name="buildDir" value="build"/>
<property name="srcDir" value="src"/>
<property name="ftp.host" value="ftp.example.com"/>
<property name="ftp.port" value="21"/>
<property name="ftp.username" value="user"/>
<property name="ftp.password" value="password"/>
<property name="ftp.dir" value="/public_html/"/>
@kbariotis
kbariotis / ancient.js
Last active August 29, 2015 13:56
AncientJS is a minimal History API implementation.
var ancientJS = {
_bindUIEvents: function() {
$("body").on("click", "a", this._linkPushed);
$(window).on("popstate", this._onPopState);
},
init: function() {
this._bindUIEvents();
},

Make it useful

  • Install Package Control. For SublimeText 2, paste the following in Terminal:
import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can 'livesearch through. After installing plugins, they should be running.

@kbariotis
kbariotis / gist:7736356
Created December 1, 2013 16:31
PHP function to get distance between two geolocations.
<?php
function distance($lat1, $lon1, $lat2, $lon2, $unit) { //unit = "K" for km, "N" for radians
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
$unit = strtoupper($unit);
<h1>Flexible columns &mdash; fixed width gutter</h1>
<h2>Using a border as faux margin</h2>
<div class="flexwrapper">
<section></section>
<section></section>
<section></section>
<section></section>
</div>