Skip to content

Instantly share code, notes, and snippets.

View emulsion-io's full-sized avatar
🏠
Working from home

Fabrice emulsion-io

🏠
Working from home
View GitHub Profile
@emulsion-io
emulsion-io / select_form_heure_min.php
Created December 22, 2013 11:23
Créer les select html pour heure et minute
<div class="form-group">
<label for="f_nom_arret">Heure de passage normal : </label>
<select name="heure">
<option value="h">heure</option>
<?php for ($heure = 00 ; $heure <= 23 ; $heure++):
$hour = sprintf("%02d", $heure);
?>
<option value="<?php echo $hour ?>"><?=$hour;?></option>
<?php endfor; ?>
</select>
@emulsion-io
emulsion-io / num_date.php
Created November 22, 2013 19:37
Liste toutes les dates ( debut et fin ) en fonction de leur numero de semaine ( attention si la semaine 1 ne commence pas un lundi )
<?php
for ($w=1; $w < 53; $w++) {
for($i = 1; $i <= 365; $i++) {
$week = date("W", mktime(0, 0, 0, 1, $i, 2014));
if($week == $w) {
$debut = date("Y-m-d", mktime(0, 0, 0, 1, $i, 2014));
$fin = date("Y-m-d", mktime(0, 0, 0, 1, $i+6, 2014));
@emulsion-io
emulsion-io / align_left.js
Created September 25, 2013 10:16
Alignement à droite avec JSPDF
function taille(string, doc)
{
var debut_zone = 145;
var largeur_zone = 25;
var font_size = 10;
var t = doc.getStringUnitWidth(string);
var result = debut_zone + (largeur_zone - (t * font_size / ( 72 / 25.6 )));
@emulsion-io
emulsion-io / ckfinder_codeigniter.php
Created September 18, 2013 13:33
Charger la session de CodeIgniter dans CKFinder.
ob_start();
include('/home/webmaster/public_html/client/mylov4/index.php');
ob_end_clean();
function CheckAuthentication()
{
$CI =& get_instance();
$CI->load->library('session');
if($CI->session->userdata('connect') !== FALSE){
@emulsion-io
emulsion-io / Media_Url_API.php
Created September 13, 2013 11:04
Parse url video pour afficher thumb et emded url
class media
{
var $CI;
function __construct()
{
$this->CI =& get_instance();
$this->CI->load->library('dmcloud');
}
@emulsion-io
emulsion-io / Géolocalisation.php
Created August 19, 2013 15:05
Géolocalisation : Calcule de distance lat/long avec Codeigniter
<?php
$this->db->select("*, ( 6371 * acos( cos( radians('".$geoc['lat']."') ) * cos( radians( geoc_adresse.lat ) ) * cos( radians( geoc_adresse.long ) - radians('".$geoc['long']."') ) + sin( radians('".$geoc['lat']."') ) * sin( radians( geoc_adresse.lat ) ) ) ) AS distance");
$this->db->join('geoc_adresse', 'geoc_adresse.id_geoc = agenda.geoc_adresse_id_geoc');
$this->db->having("distance < '".$geoc['km']."'");
$this->db->order_by('distance');
?>