Skip to content

Instantly share code, notes, and snippets.

View arielallon's full-sized avatar
🙊

Ariel Allon arielallon

🙊
View GitHub Profile
@arielallon
arielallon / svnup-chown.sh
Created December 5, 2013 17:00
svn up + chown
sudo svn up | awk '{print $2;}' | sed '$d' | xargs chown aallon:www-data -v
@arielallon
arielallon / 0_reuse_code.js
Created December 10, 2013 21:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@arielallon
arielallon / Item.php
Created December 13, 2013 14:27
this is a test
art->addProduct($product, $buyRequest);
if (!$product->isVisibleInSiteVisibility()) {
$cart->getQuote()->getItemByProduct($product)->setStoreId($storeId);
}
<?php
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
if (!$installer->getAttributeId(Mage_Catalog_Model_Product::ENTITY, 'attribute_name')) {
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'attribute_name', array( // TABLE.COLUMN: DESCRIPTION:
'label' => 'Label', // eav_attribute.frontend_label admin input label
'group' => 'General', // (not a column) tab in product edit screen
'sort_order' => 0 // eav_entity_attribute.sort_order sort order in group
'backend' => 'module/class_name', // eav_attribute.backend_model backend class
@arielallon
arielallon / createdbandassignuser.sql
Created June 9, 2014 18:47
MySQL create DB & assign a user
CREATE DATABASE dbname;
CREATE USER 'dbuser'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'%';
FLUSH PRIVILEGES;
@arielallon
arielallon / svnadd.sh
Last active August 29, 2015 14:03
SVN add (and rm) all new files (e.g. from a merge)
svn status | grep "^\?" | awk '{print $2}' | xargs svn add;
svn status | grep "^\!" | awk '{print $2}' | xargs svn rm;
@arielallon
arielallon / rsync.sh
Last active August 29, 2015 14:03
sample rsync of media directory
rsync -rltpDhv -e "ssh -p 2201" /path/to/local/media/ [email protected]:/home/aallon/uat/media/
@arielallon
arielallon / addtobashrc.sh
Created July 21, 2014 17:53
xdebug in phpstorm from vagrant cli
export PHP_IDE_CONFIG="serverName=local.project.com"
export XDEBUG_CONFIG="remote_host=192.168.56.1 idekey=PHPSTORM"
alias phpx='php -d "xdebug.profiler_enable=1" -d "xdebug.remote_host=192.168.56.1"'
# then run phpx -f filename.php
@arielallon
arielallon / extension.sh
Created August 25, 2014 21:04
Move files into folders by extension
#!/bin/bash
recup_dir="${1%/}"
echo "$recup_dir";
[ -d "$recup_dir" ] || {
echo "Usage: $0 recup_dir";
echo "Mirror files from recup_dir into recup_dir.by_ext, organized by extension";
exit 1
};
@arielallon
arielallon / drop_all_db_tables.sh
Created September 5, 2014 18:51
Drop all tables
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "drop table $table" DATABASE_NAME; done
# http://stackoverflow.com/a/8912749/1200542