Skip to content

Instantly share code, notes, and snippets.

View flashvnn's full-sized avatar

Huynh Khac Thao flashvnn

View GitHub Profile
@flashvnn
flashvnn / node-alias
Created April 5, 2015 15:25
Node alias with terms parent
[node:field-category:parents:join:/]/[node:field-category:name]/[node:title]
@flashvnn
flashvnn / config-drush.bash
Created April 7, 2015 02:19
Config Drush working with PHP5.5 with Software Collection
# open drush file with command vi /usr/bin/drush and find line bellow
if [ ! -x "$php" ]; then
# php="/usr/bin/php" # find and comment this line
php="/opt/rh/php55/root/usr/bin/php" # add this line set php path to php55
fi
if [ ! -x "$php" ]; then
echo "ERROR: can't find php."; exit 1
fi
@flashvnn
flashvnn / config.xml
Created April 16, 2015 03:48
Rewrite url in Magento to make wildcard url
<rewrite>
<forix_ajax>
<from><![CDATA[/fajax\/(.*)/]]></from>
<to><![CDATA[/fajax/index/index/$1/]]></to>
<complete>1</complete>
</forix_ajax>
</rewrite>
@flashvnn
flashvnn / magento-dir.php
Created April 23, 2015 03:35
Magento dir
<?php
class Mage_Core_Model_Config_Options extends Varien_Object
{
/* ... */
protected function _construct()
{
$appRoot= Mage::getRoot();
$root = dirname($appRoot);
$this->_data['app_dir'] = $appRoot;
@flashvnn
flashvnn / ajaxcart.js
Created April 27, 2015 08:19
Prevent onClick function with jQuery
$("button.btn-cart:not(ajax-processed)").addClass("ajax-processed").each(function(){
$(this).data('onclick', this.onclick);
this.onclick = function(){
return false;
}
});
@flashvnn
flashvnn / execjsbyname.js
Created May 8, 2015 02:40
Javascript: execute function by name
FormBuilder = {
PlainText: function (object) {
alert (object);
}
};
// From: http://stackoverflow.com/questions/359788/javascript-function-name-as-a-string
function executeFunctionByName(functionName, context /*, args */) {
var args = Array.prototype.slice.call(arguments, 2);
var namespaces = functionName.split(".");
var func = namespaces.pop();
@flashvnn
flashvnn / test.json
Created May 19, 2015 07:22
TestJSON
{"error":false,"action":"viewresult","result":"<div class=\"result-header\">\n \n\t<\/div>\n\n
\n \n<div class=\"store-items\">\n\n\t<div class=\"store\" >\n\t \n\t\t\t\t\t\t<div class
=\"image\">\n\t\t\t<img src=\"http:\/\/sexyhair.local\/skin\/frontend\/rwd\/sexyhair\/images\/locations
\/salon1.png\" \/>\n\t\t<\/div>\n\t\t\t\t\t\t<div class=\"info\">\n\t\t\t<h4>ART_VAN - Pure Sleep2<\
/h4>\n\t\t\t<div class=\"addr\">2570 Jackson Rd Ann Arbor Alabama <span>48103<\/span><\/div>\n\t\t<\
/div>\t\n\t\t<div class=\"divider\"><\/div>\n\t<\/div>\n\n\n\t<div class=\"store\" >\n\t \n\t\t
\t\t\t\t<div class=\"image\">\n\t\t\t<img src=\"http:\/\/sexyhair.local\/skin\/frontend\/rwd\/sexyhair
\/images\/locations\/salon2.png\" \/>\n\t\t<\/div>\n\t\t\t\t\t\t<div class=\"info\">\n\t\t\t<h4>Gardiners
Furniture &amp; Mattress2<\/h4>\n\t\t\t<div class=\"addr\">1530 E Joppa Rd. Towson Alabama <span>21286
<\/span><\/div>\n\t\t<\/div>\t\n\t\t<div class=\"divider\"><\/div>\n\t<\/div>\n\n\n\t<div class=\"
@flashvnn
flashvnn / cmd
Created June 19, 2015 15:24
Change PHP version of AMPPS on MAC OS
ln -s /Applications/AMPPS/php-5.5 /Applications/AMPPS/php
@flashvnn
flashvnn / InlineElement.cs
Last active September 27, 2015 09:53
Xamarin Inline Elements
Content = new StackLayout{
Padding = new Thickness(0),
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.FillAndExpand,
Children = {
new Label {
Text = "This uses TitleStyle",
Style = Device.Styles.TitleStyle
},
new Button {
@flashvnn
flashvnn / adb_get_database
Created July 20, 2015 22:56
Android Get database file with ADB
adb pull /data/data/com.packagename/files/filename.db