Skip to content

Instantly share code, notes, and snippets.

View mcgivrer's full-sized avatar
🌐
Work onto a Platform !

Frédéric Delorme mcgivrer

🌐
Work onto a Platform !
View GitHub Profile
<?php
/**
* Debug class : output debug message to interface & file.
* @author Frédéric Delorme<frederic.delorme@gmail.com>
*/
include_once("private/modules/error.class.php");
class Debug{
private static $_instance = null;
private static $path="";
private static $messages = array();
<?php
/**
* Configuration file: retrieve config.ini file (set your own path)
* and load it into an array. use the <code>__config(group,key)</code> to
* retrieve value from config.ini file.
* @author Frédéric Delorme<frederic.delorme@gmai.com>
* @version 11/07/2010
*/
class Config{
static $_instance = null;
<?php
/**
* Cache manager.
* if a cache file named following url'ification rules already exists,
* the file is serve in place of generated one with PHP scripting.
* Files are store into a default cache path "../cache/" relatively to the root
* of web site (htdocs, in apache world).
*
* Extracted from http://github.com/mcgivrer/Games project
*
<?php
/**
* Abstract Class for Singleton Pattern management.
* @author Frédéric Delorme<frederic.delorme@gmail.com>
* @version 1.0
* @copyright 2010/08/15
*
*/
abstract class Singleton
{
<?php
class ImageThumbs{
private static $_instance;
// array of size to be generated, sample : array('320x200','80x120')
private $thumbsFormats=array();
private $thumbsFileFormat="png";
public $imgTypes = array(
1 => 'GIF',
@mcgivrer
mcgivrer / dabblet.css
Created February 28, 2012 13:35
Untitled
p{
margin:0px;
padding:0px;
}
article.post {
font-family: Tahoma;
font-size: 10pt;
/*width:90%;
margin:0% 5%;*/
}
@mcgivrer
mcgivrer / dabblet.css
Created February 28, 2012 17:21
Untitled
p{
margin:0px;
padding:0px;
}
article.post {
font-family: Tahoma, Verdana, Sans Serif;
font-size: 10pt;
width:90%;
margin:0% 5%;
}
@mcgivrer
mcgivrer / Dao.java
Created June 6, 2012 13:18
A DAO and its Generic implementation inspired/guided by an Augusto GIST and simplified/adapted (see reference in the first file)to our needs.
package fr.mcgivrer.framework.web.persist;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
public interface Dao <T, PK extends Serializable> {
/**
* save an entity. This can be either a INSERT or UPDATE in the database.
*
@mcgivrer
mcgivrer / cibox.sh
Created November 9, 2012 00:40
A small script to start/stop all services for a Continuous Integration Server.
#!/bin/bash
# Small script to start/stop a
# Continuous Integration server based on ubuntu 12.04.
# inspired by sonar service script.
# (copyleft) 2012 - McGivrer
#
checkUser() {
# $1 touchLock flag
# $2 command
@mcgivrer
mcgivrer / GenericDaoTest.java
Last active December 13, 2015 23:28
Here is a small piece of code to parse package and detect @entity annotated classes. Starting from a persistence.xml file wich describe a "application" persistence unit, Annotated classes would be added to the EntityManager created, based on persistence.xml configuration. No more need to add <class /> tags to the persistence file. thanks to Refl…
package fr.mcgivrer.applications.angulargames.test.dao;
import java.util.Map;
import java.util.Properties;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;