Skip to content

Instantly share code, notes, and snippets.

@julienhay
julienhay / codes.go
Last active May 10, 2016 17:50
Code generator
package main
import (
"github.com/lazybeaver/xorshift"
"log"
"os"
"strconv"
"time"
)
@julienhay
julienhay / Selenium2TestCase-cheat-sheet.md
Last active July 17, 2021 20:50
Cheat sheet for using Selenium2TestCase v1.4 extension PHPUnit (PHPUnit_Extensions_Selenium2TestCase)

Cheat sheet for using Selenium2TestCase v1.4 extension PHPUnit

Prepare browser

  • Full screen browser
class ClassTest extends \PHPUnit_Extensions_Selenium2TestCase
{
    public static $browsers = array(
        array(
@julienhay
julienhay / note.md
Created November 24, 2015 09:51
Command usefull

Staging syncro

yes | .... | grep -ve "/$"

@julienhay
julienhay / UniqueFileGeneratorService.php
Last active August 26, 2015 15:45
Unique File generator
<?php
namespace AppBundle\Service;
use Cocur\Slugify\Slugify;
class UniqueFileNameGeneratorService
{
private $slugify;
private $original_filename;
@julienhay
julienhay / cmd.md
Last active May 27, 2019 22:15
Boot2docker insecure registry

boot2docker ssh 'sudo sh -c "echo "EXTRA_ARGS=\"--insecure-registry 192.168.0.0/16\"" > /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart"'

docker-compose up --allow-insecure-ssl -d

/**
* @Route("/upload_image_wysiwyg", name="upload_image_wysiwyg", options={"expose"=true})
*/
public function uploadImageWYSIWYGAction(Request $request)
{
$user = $this->getLoggedUser();
if(!$user)
{
return new JsonResponse(array('success'=>false,"error"=>"bad request"));
@julienhay
julienhay / gulpfile.litcoffee
Created January 13, 2015 09:08
gulp litcoffee

Gulpfile

Create React component using:

  • Coffescript

    • Preprocessing for javascript language
  • React / JSX

    • Javascript library that allow to create component that mixed View (HTML) and Controller (JS) with the MVVM pattern
@julienhay
julienhay / gist:ae03c7804d68332ae9d1
Created December 22, 2014 10:47
Send mail mandrill
$dispatcher = $this->get('hip_mandrill.dispatcher');
$message = new Message();
$message
->setFromEmail('mail@example.com')
->setFromName('Customer Care')
->addTo('jules.hay@gmail.com')
->setSubject('Some Subject')
@julienhay
julienhay / gulpfile.js
Last active February 27, 2016 18:51
Gulp file intégration ES => Jade + Compass + Watch
var gulp = require('gulp'),
compass = require('gulp-compass'),
jade = require('gulp-jade'),
watch = require('gulp-watch');
var integration_folder = 'web/integration/';
var assets_folder = integration_folder+'assets/';
function error(message) {
console.log("Error : "+message.toString());
@julienhay
julienhay / getpostsbylang.php
Created October 23, 2014 08:40
Get posts by lang WPML
<?php
function get_posts_by_lang($args = array(), $lang = "fr") {
global $wpdb;
$post_table = $wpdb->posts;
$translation_table = $wpdb->prefix . 'icl_translations';
$sql = "
SELECT ID