Skip to content

Instantly share code, notes, and snippets.

View sylvainraye's full-sized avatar

Sylvain Rayé sylvainraye

View GitHub Profile

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.

@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\]"
@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 / 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 / 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}'
<?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 / 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%'
@sylvainraye
sylvainraye / SoapClient.php
Created October 17, 2013 11:23
SOAP Client debugging with Zend Debugger
<?php
/**
* Class based on the blog article of Maxune.com
*
* @category Diglin
* @package Diglin_Debug
* @copyright Copyright (c) 2013 Diglin GmbH - Switzerland
* @license none
* @version 1.0.0
* @link http://moxune.com/blog/2011/09/debug-soap-server-zend-studio/
<?php
namespace Linkofy\CommonBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)