Mounting shared folders between OSX and the docker container is tricky due to
the intermediate boot2docker VM. You can't use the usual docker -v
option as
the docker server knows nothing about the OSX filesystem - it can only mount
folders from the boot2docker filesystem. Fortunately, you can work around this
using SSHFS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/2593139/ipad-web-app-detect-virtual-keyboard-using-javascript-in-safari | |
var currentscroll = 0; | |
$('input').bind('focus',function() { | |
currentscroll = $(window).scrollTop(); | |
}); | |
$('input').bind('blur',function() { | |
if(currentscroll != $(window).scrollTop()){ | |
$(window).scrollTop(currentscroll); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(arg(0) == 'node' && arg(2) == 'edit'){ /*...*/} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
builder.setMessage("Content").setTitle("Title"); | |
AlertDialog dialog = builder.create(); | |
dialog.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get all simple products | |
$simples = Mage::getResourceModel('catalog/product_collection') | |
->addAttributeToFilter('type_id', array('eq' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)); | |
// Get their ids | |
$ids = array(); | |
foreach ($simples as $simple) { | |
$ids[] = $simple->getId(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.each(someObject, function(item, key) { | |
if(!(key in someOtherObject)) { | |
// do something here | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Fugly hack, because apparently displaying prices requires a degree in rocket surgery | |
// replaced with normal code | |
$products = $_product->getTypeInstance()->getAssociatedProducts(); | |
$min = 999999999; | |
foreach ($products as $product){ | |
$price = $product->getPrice(); | |
if ($price < $min) | |
$min = $price; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this is my custom function that gets ID of currently selected bike make | |
$selectedMake = getSelectedMake(); | |
// now I am filtering | |
// I need to get only the products that have this make, but one product may have many different makes | |
// so if it has many makes, it is an array and we need to use 'finset' like so | |
if($selectedMake !== null) { | |
$productCollection->addAttributeToFilter(array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Checks given coordinate for errors | |
* @param string $coordinate coordinate | |
* | |
* @return bool result | |
*/ | |
public function checkCoordinate($coordinate) { | |
if(preg_match('/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?);[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/', $coordinate)) { | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* filter array and keep every value only once | |
* @param array arr input array | |
* | |
* @return array array containing only unique values | |
*/ | |
function arrUnique(arr) { | |
arr = arr.filter(function (val, i, self) { | |
return self.indexOf(val) === i; | |
}); |
OlderNewer