This file contains 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
#!/bin/bash | |
# Auto suspend and wake-up script | |
# | |
# Puts the computer on standby and automatically wakes it up at specified time | |
# | |
# Written by Romke van der Meulen <redge.online@gmail.com> | |
# Minor mods fossfreedom for AskUbuntu | |
# | |
# Takes a 24hour time HH:MM as its argument |
This file contains 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 | |
$updateAttributeOptionValue = function() { | |
$attribute_model = Mage::getModel('eav/entity_attribute'); | |
$attribute_id = $attribute_model->getIdByCode('catalog_product', 'color'); | |
$attribute = $attribute_model->load($attribute_id); | |
$arrColor = array( | |
'Brown', |
This file contains 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 | |
$checkProductHaveOption = function() { | |
$productIds = Mage::getModel('catalog/product')->getCollection()->getAllIds(); | |
$productModel = Mage::getModel('catalog/product'); | |
$arrProductIdHaveOption = array(); | |
foreach ($productIds as $key =>$productId ) { | |
$productObj = $productModel->load($productId); | |
if($productObj->getHasOptions()) { |
This file contains 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
require_once(ABSPATH . "wp-admin" . '/includes/image.php'); | |
require_once(ABSPATH . "wp-admin" . '/includes/file.php'); | |
require_once(ABSPATH . "wp-admin" . '/includes/media.php'); | |
if(!$_FILES) { | |
wp_die(''); // Do nothing | |
} | |
// check max allowed | |
$max_upload_gal_img = of_get_option(Apollo_DB_Schema::_MAX_UPLOAD_GALLERY_IMG, Apollo_Display_Config::MAX_UPLOAD_GALLERY_IMG); |
This file contains 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
/* | |
$primary_img_sel: main image you want to drop | |
boxWidth: box contain image. which you want. I usally less than image size | |
boxHeight: same boxWidth | |
trueSize: True size of image | |
keySupport: there are on bug in current i write. When i press image it alwasy go to bottom of page | |
onChange: when we click on the image. I will change coordinate and width and height. c.w, c.h, c.x, c.y, c.x2, c.y2 | |
*/ | |
$primary_img_sel.Jcrop({ |
This file contains 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
change_param_in_query_by_key_value = function(key, value, query) { | |
var arrParams = query.parseQuery(); | |
if(typeof arrParams[key] === "undefined") { | |
return query; | |
} | |
var _value = arrParams[key], _arr = _value.split('-'); | |
var position_occur_in_value_query = $j.inArray(value, _arr); | |
if(position_occur_in_value_query === -1) { | |
return query; |
This file contains 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 | |
$deleteCatByName = function($catname) { | |
$category = Mage::getModel('catalog/category'); | |
$tree = $category->getTreeModel(); | |
$tree->load(); | |
$ids = $tree->getCollection()->getAllIds(); | |
if ($ids){ | |
foreach ($ids as $id){ |
This file contains 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
(function($) { | |
var $arr_checkall = $('[data-ride="ap-checkboxall"]'); | |
/* bind checkall */ | |
$arr_checkall.click(function() { | |
var $this = $(this), | |
_data = $this.data(); | |
$(_data.child_selector).prop('checked', $(this).is(':checked')); |
This file contains 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
mysqldump -u root -pyourpass --default-character-set=latin1 -c --insert-ignore --skip-set-charset your_database > dev.db | |
for i in dev; do iconv -f ISO-8859-1 -t UTF-8 <$i.db >${i}8.db; done | |
for i in *8.db; do perl -pi -w -e 's/CHARSET=latin1/CHARSET=utf8/g;' $i; done | |
for i in your_database; do mysql --user=root --password=yourpassword --execute "DROP DATABASE $i; CREATE DATABASE $i CHARACTER SET utf8 COLLATE utf8_general_ci;"; done | |
mysql --user=root --password=yourpassword --max_allowed_packet=16M --default-character-set=utf8 your_database < dev8.db |
This file contains 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 | |
$createCategory = function() { | |
$data = array(); | |
$arrKey = array( | |
'Men', | |
'Men/Shirts', | |
'Men/New Arrivals', | |
'Men/Tees, Knits and Polos', |