Skip to content

Instantly share code, notes, and snippets.

View jacquesbh's full-sized avatar
🏠
Working from home

Jacques Bodin-Hullin jacquesbh

🏠
Working from home
View GitHub Profile
@jacquesbh
jacquesbh / restore.sh
Created July 9, 2012 08:37
Restore a local database with .sql.gz file
# Restore a database
function restore()
{
if [[ $# < 2 ]]; then
echo "Usage: restore <database> <file.sql[.tar].gz> [-gz]"
echo "Use -gz option if you want to restore an only gziped file"
return 65
fi
if [[ -f $2 ]]; then
@jacquesbh
jacquesbh / fr.jacquesbh.apache2.plist
Created July 13, 2012 06:29
Launch daemon for apache2 on mac (in /System/Library/LaunchDaemons/)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>fr.jacquesbh.apache2</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/apache2/bin/apachectl</string>
<string>start</string>
<?php
/**
* Email Model
* @package Jbh_Demo
*/
class Jbh_Demo_Model_Email extends Mage_Core_Model_Abstract
{
/**
@jacquesbh
jacquesbh / misc-change_admin_password.php
Created July 18, 2012 23:06
Script for change admin password
<?php
declare(ticks = 1);
// Mage !
require_once __DIR__ . '/../app/Mage.php';
// Usage function :)
function usage()
{
<?xml version="1.0" encoding="utf-8" ?>
<!--
/**
* This file is part of Jbh_Webservice for Magento.
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
# Prompt
# Get the branch name of the current directory
git_branch()
{
if git rev-parse --git-dir >/dev/null 2>&1 ; then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
return 0
fi
if [[ $# == 1 ]]; then
@jacquesbh
jacquesbh / boobs.php
Created August 7, 2012 08:22
One char upper, One char lower
echo trim(preg_replace_callback('/(.)(.)/isU', function ($matches) {
return strtoupper($matches[1]) . strtolower($matches[2]);
}, $txt));
http://sam.zoy.org/wtfpl/COPYING
@jacquesbh
jacquesbh / a
Created September 3, 2012 07:59
[post] Git en entreprise (http://jacques.sh/git-en-entreprise.html)
We couldn’t find that file to show.
@jacquesbh
jacquesbh / example_01.php
Last active October 10, 2015 06:08
[blog] Le cache des blocks sur Magento (http://jacques.sh/le-cache-des-blocks-sur-magento.html)
<?php
namespace Jbh;
class Counter
{
use \Jbh\Db;
protected $_cache = [];