Skip to content

Instantly share code, notes, and snippets.

View JulienBreux's full-sized avatar

Julien Breux JulienBreux

View GitHub Profile
@JulienBreux
JulienBreux / layout.html
Created August 6, 2012 13:11
HTML5 - Simple layout
<!doctype html>
<!--[if lt IE 7 ]> <html lang="fr" class="lang-fr no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="fr" class="lang-fr no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="fr" class="lang-fr no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="fr" class="lang-fr no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="fr" class="lang-fr no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@JulienBreux
JulienBreux / .profile
Created April 26, 2012 16:07
Mac Profile
# Alias
alias apache='sudo /opt/local/apache2/bin/apachectl'
alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &'
alias mysqlstop='sudo /opt/local/bin/mysqladmin5 -u root -p shutdown'
alias ls='ls -G'
alias ll='ls -hl'
# Sources
# Use (http://www.git-attitude.fr/2010/07/14/le-prompt-bash-qui-change-la-vie-avec-git/)
source "$HOME/.git-completion.bash" &&
@JulienBreux
JulienBreux / gist:2427846
Created April 20, 2012 11:17
Remove website (sudo ./removeSite.php <user> <host>)
#!/usr/bin/php
<?php
define('SUCCESS', "\033[32m".'OK'."\033[37m - ");
define('WARN', "\033[31m".'INFO'."\033[37m - ");
define('EOL', "\n");
## FUNCTIONS
function pecho($string) {fwrite(STDOUT, $string);}
@JulienBreux
JulienBreux / gist:2427844
Created April 20, 2012 11:16
Add website (sudo ./addSite.php <user> <host> <alias>)
#!/usr/bin/php
<?php
define('SUCCESS', "\033[32m".'OK'."\033[37m - ");
define('WARN', "\033[31m".'INFO'."\033[37m - ");
define('EOL', "\n");
## FUNCTIONS
function pecho($string) {fwrite(STDOUT, $string);}
@JulienBreux
JulienBreux / DbFactory.php
Created April 2, 2012 22:12
PrestaShop 1.5.x - Database Factory
<?php
/**
* Database Factory
* Use this factory for connections to external databases
*
* @version 1.0.0
* @author Julien BREUX <julien.breux@prestashop.com>
*/
class DbFactoryCore
{
@JulienBreux
JulienBreux / server.rb
Last active August 29, 2015 14:23
Micro-Server to validate oAuth2 roles :)
# How to use:
#
# $ruby server.rb
# $curl --header "X-Company-Roles: manager" --header "X-Company-Roles: admin" http://localhost:2345/
require 'socket'
require 'json'
server = TCPServer.new('localhost', 2345)
@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
alias debian="docker run --rm -ti debian:jessie /bin/bash"
alias ubuntu="docker run --rm -ti ubuntu:jessie /bin/bash"
@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
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?