Skip to content

Instantly share code, notes, and snippets.

View ScullWM's full-sized avatar
🌶️
Caramba! PepperReport.io!

Thomas P ScullWM

🌶️
Caramba! PepperReport.io!
View GitHub Profile
@ScullWM
ScullWM / readme.md
Last active April 5, 2016 10:17
translation-server

Install translation-server

  1. Download directly the phar here: https://github.com/ScullWM/translation-server/tree/dev_dead/build/translation-server.phar (DeadKey Edition) It's a fork from mmoreram/translation-server (Look like not maintained anymore)

  2. Move it to your bin path: cp build/translation-server.phar /usr/local/bin/translation-server

Configure your project

Create a .translation.ymlfile in app/Resources/translations

<?php
class test {
$typeAssoc = [
DocumentInterface::TYPE_QUOTATION => DocumentInterface::CLASSNAME_QUOTATION,
DocumentInterface::TYPE_QUOTATION => DocumentInterface::CLASSNAME_QUOTATION,
DocumentInterface::TYPE_QUOTATION => DocumentInterface::CLASSNAME_QUOTATION,
DocumentInterface::TYPE_QUOTATION => DocumentInterface::CLASSNAME_QUOTATION,
];
@ScullWM
ScullWM / test.php
Created March 3, 2016 08:44
Recurr benchmark
<?php
use Symfony\Component\Stopwatch\Stopwatch;
$loader = require __DIR__.'/./app/autoload.php';
// Debug::enable();
$stopwatch = new Stopwatch();
<?php
namespace Swm\Bundle\ForumBundle\Listener;
use JMS\DiExtraBundle\Annotation as DI;
use Swm\Bundle\MailHookBundle\Event\HookEventInterface;
/**
* @DI\Service()
*/
@ScullWM
ScullWM / Momentjs
Created October 17, 2014 13:32
Momentjs basic usage
<script>
moment.locale('fr');
var now = moment();
$('.time').each(function(i, e) {
var time = moment($(e).text(), $(e).data('moment-format'));
$(e).html(time.from(now));
});
</script>
git filter-branch -f --index-filter 'git rm -r --cached --ignore-unmatch path/to/my/specific/file.ext' HEAD
git push -u origin master --force
Source : http://help.github.com/remove-sensitive-data/
@ScullWM
ScullWM / recursive.php
Created March 7, 2014 09:29
Strange var
<?php
$Directory = new RecursiveDirectoryIterator(__DIR__);
$Iterator = new RecursiveIteratorIterator($Directory, RecursiveIteratorIterator::SELF_FIRST);
$Regex = new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
echo'<pre>';
var_dump($Regex);
<?php
require 'deployer.phar';
task('prod_server', function () {
connect('prod.ssh.test.com', 'user', 'password');
});
task('upload', function () {
upload(__DIR__, '/home/test');
<?php
class crm_info extends CoreController {
public $ItemPerPage = '10';
public $ItemPerGroup = '10';
/**
* @param int $_GET['page'] Displayed page
public function getPdf($isSecondPage = false, $filename = 'facture')
{
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A3', true, 'UTF-8', false);
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, '', '');
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);