Skip to content

Instantly share code, notes, and snippets.

View sylvainraye's full-sized avatar

Sylvain Rayé sylvainraye

View GitHub Profile
@sylvainraye
sylvainraye / searchandreplace
Created October 2, 2013 07:50
Search and replace SQL Query
UPDATE Table SET champ=REPLACE(champ,'chaine 1','chaine 2') WHERE champ LIKE '%chaine 1%'
<?php
class EcomDev_Optimization_Model_Resource_Attribute_Source_Table extends Mage_Eav_Model_Entity_Attribute_Source_Table
{
protected static $_preloadedOptions = array();
protected static function _getStoreOptions($storeId, $attributeId)
{
if (!isset(self::$_preloadedOptions[$storeId])) {
$options = Mage::getResourceModel('eav/entity_attribute_option_collection')
@sylvainraye
sylvainraye / countlinesofcode.sh
Created September 13, 2013 12:38
Count the number of coded lines
find . -type f -name '*.php' -exec awk 'END {print NR}' '{}' + 2>/dev/null | awk '{ total+=$1 }END{print total}'
@sylvainraye
sylvainraye / diffandcopy.sh
Last active December 22, 2015 23:58
Awk command for diff and copy file
# do an echo only of the result
diff -x "CVS" -x '.svn*' -bqr originaux/magento17/include/ myproject/include/ | grep "Only in originaux" | awk '{gsub(":", "", $3); filesource=$3"/"$4; print filesource; gsub("originaux/magento17/", "myproject/", $3); filetarget=$3"/"$4; print filesource" - "filetarget; }'
# do the copy
diff -x "CVS" -x '.svn*' -bqr originaux/magento17/include/ myproject/include/ | grep "Only in originaux" | awk '{gsub(":", "", $3); filesource=$3"/"$4; print filesource; gsub("originaux/magento17/", "myproject/", $3); filetarget=$3"/"$4; system ("cp -R "filesource" "filetarget); }'
@sylvainraye
sylvainraye / gitdeleteallbranches-exceptmaster.sh
Created September 10, 2013 08:52
Delete all branches of a Git repo (locally and remotely) except the master branch
for t in `git branch | grep -v "master"`
do
git branch -D $t
git push --delete origin $t
done
@sylvainraye
sylvainraye / gist:5712289
Created June 5, 2013 07:55
Bash display improvement for Git repo (show if you are in which branch)
#functions to show git branch in prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.