Skip to content

Instantly share code, notes, and snippets.

View JulienBreux's full-sized avatar

Julien Breux JulienBreux

View GitHub Profile
@JulienBreux
JulienBreux / gist:10776219
Last active August 29, 2015 13:59
PHP - Error to Exception
<?php
set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontex) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});
@JulienBreux
JulienBreux / README.md
Last active August 29, 2015 14:01
Jira - Epics

How to install?

curl -O https://getcomposer.org/composer.phar
php composer.phar install

How to use?

php -S locahost:8888

@JulienBreux
JulienBreux / PluginAbstract.php
Created August 20, 2014 13:07
Plugin abstract example
<?php
namespace Iadvize\Admin\Plugin;
/**
* Class PluginAbstract
*
* @package Iadvize\Admin\Plugin
*/
abstract class PluginAbstract
@JulienBreux
JulienBreux / etc-network-interfaces
Last active August 29, 2015 14:16
Proxmox Master Host
auto vmbr1
iface vmbr1 inet static
address 10.10.10.254
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
var ioClient = require('socket.io-client')('http://127.0.0.1');
ioClient.on('connect', function () {
ioClient.emit('broadcast', 'first-event', 'Hello');
ioClient.emit('broadcast', 'second-event', 'World');
});
class Document < ActiveRecord::Base
belongs_to :parent, class_name: 'Document'
def self.get_ancestors(who)
@tree ||= []
# @tree is instance variable of Document class object not document instance object
# so: Document.get_instance_variable('@tree')
if who.parent.nil?
@JulienBreux
JulienBreux / puma.sh
Last active August 29, 2015 14:21 — forked from runlevel5/puma.sh
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
alias debian="docker run --rm -ti debian:jessie /bin/bash"
alias ubuntu="docker run --rm -ti ubuntu:jessie /bin/bash"
@JulienBreux
JulienBreux / gem.sh
Last active August 29, 2015 14:22
Specific Gem Version
gem rails _1.0.0_ --version
gem rails _2.0.0_ --version