Skip to content

Instantly share code, notes, and snippets.

👨‍💻

Joshua Estes JoshuaEstes

👨‍💻
Block or report user

Report or block JoshuaEstes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JoshuaEstes
JoshuaEstes / Deploy using SSH
Created Feb 3, 2011
A co-worker is a GOD of men, I challenged him to use one line a command to take files for a current git project and push those to a remote server. This is what he came up with.
View Deploy using SSH
git archive --format=tar HEAD | ssh username@server tar xf - -C /path/to/folder
@JoshuaEstes
JoshuaEstes / sfAuthTestFunctional.class.php
Created Apr 26, 2011
Use with symfony1.4.x to sign in/out to secure parts of the site. This is meant to be used with sfDoctrineGuardPlugin but can be changed to be used with others.
View sfAuthTestFunctional.class.php
<?php
class sfAuthTestFunctional extends sfTestFunctional
{
/**
* @param string $username
* @param string $password
* @return sfAuthTestFunctional
*/
@JoshuaEstes
JoshuaEstes / reset_admin.sql
Created Apr 27, 2011
Reset a magento admin user password
View reset_admin.sql
UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';
@JoshuaEstes
JoshuaEstes / ssh-copy-id.sh
Created Jun 2, 2011
Command line example of how to add your key to a remote computer to avoid entering in a password out of laziness.
View ssh-copy-id.sh
cat ~/.ssh/id_rsa.pub | ssh username@host "cat - >> ~/.ssh/authorized_keys"
@JoshuaEstes
JoshuaEstes / delete_products.sql
Created Sep 14, 2011
Delete all products in magento
View delete_products.sql
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
TRUNCATE TABLE `catalog_product_entity_text`;
@JoshuaEstes
JoshuaEstes / delete_categories.sql
Created Sep 14, 2011
Delete all categories in Magento
View delete_categories.sql
TRUNCATE TABLE `catalog_category_entity`;
TRUNCATE TABLE `catalog_category_entity_datetime`;
TRUNCATE TABLE `catalog_category_entity_decimal`;
TRUNCATE TABLE `catalog_category_entity_int`;
TRUNCATE TABLE `catalog_category_entity_text`;
TRUNCATE TABLE `catalog_category_entity_varchar`;
TRUNCATE TABLE `catalog_category_product`;
TRUNCATE TABLE `catalog_category_product_index`;
insert into `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`position`,`level`,`children_count`) values (1,3,0,0,'0000-00-00 00:00:00′,'2009-02-20 00:25:34′,'1′,1,0,1),(2,3,3,0,'2009-02-20 00:25:34′,'2009-02-20 00:25:34′,'1/2′,1,1,0);
insert into `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,32,0,2,1),(2,3,32,1,2,1);
@JoshuaEstes
JoshuaEstes / .bashrc
Created Sep 16, 2011
Add this to the end of your ~/.bashrc to display what branch you are working in with git
View .bashrc
parse_git_branch () {
git symbolic-ref HEAD 2> /dev/null | sed -e 's/\^0$//' | sed 's#refs\/heads\/\(.*\)#\1#'
}
BLACK="\[\033[0;38m\]"
RED="\[\033[0;31m\]"
RED_BOLD="\[\033[01;31m\]"
BLUE="\[\033[01;34m\]"
GREEN="\[\033[0;32m\]"
@JoshuaEstes
JoshuaEstes / moduleActionsTest.php
Created Oct 21, 2011
Test template for a symfony 1.4 admin generated action
View moduleActionsTest.php
<?php
/**
* Symfony admin generator test template
* @see https://gist.github.com/1304240
*/
/**
* The model name
*/
$model = 'ModelName';
@JoshuaEstes
JoshuaEstes / remove_svn.sh
Created Oct 22, 2011
remove all svn folders in a directory and sub directories
View remove_svn.sh
find . -name ".svn" -type d -exec rm -rf {} \;
@JoshuaEstes
JoshuaEstes / convert_to_csv
Created Dec 2, 2011
convert something to csv
View convert_to_csv
perl -F"\t" -lane 'print join ",", map {s/"/""/g; /^[\d.]+$/ ? $_ : qq("$_")} @F '
You can’t perform that action at this time.