Skip to content

Instantly share code, notes, and snippets.

@phenix-factory
phenix-factory / cookie.js
Created May 22, 2013 16:11
Gestion simplifiée des cookies en Javascript
@phenix-factory
phenix-factory / attr.html
Last active April 29, 2019 09:41
Handle #attr
<form #f="ngForm" (ngSubmit)="saveDocument()">
<!-- General info -->
<table class="document-modal__info-table">
<thead>
<tr>
<th>
{{ 'general.general_info' | translate }}
</th>
<th class="text-right" colspan="2">
<a
@phenix-factory
phenix-factory / spip.gitignore
Last active April 16, 2018 13:43
SPIP: Gitignore pour SPIP
config/connect.php
config/bases/
tmp/
/IMG/
local/
.backup
.svn*
svn*
.htaccess
@phenix-factory
phenix-factory / .gitignore_global
Created December 30, 2016 13:18
gitignore global
#Backup
*~
# Fichier OSX
.DS_Store
.AppleDouble
.LSOverride
Icon
# Fichier de projet Sublime text
@phenix-factory
phenix-factory / spip_vertige.sh
Created October 17, 2016 11:58
spip_vertige install
#!/bin/bash
# Placer le fichier spip.gitignore
wget https://gist.githubusercontent.com/phenix-factory/7134623/raw/edfa67dadab5956c292060404511bb14951a3b18/spip.gitignore -O .gitignore
# Placer le fichier spip.git-ftp-ignore
wget https://gist.githubusercontent.com/phenix-factory/92c90bad7955e0e8e69e/raw/a711f8c67f1698681516b2493c0420bfda8e78ed/spip.git-ftp-ignore -O .git-ftp-ignore
# Créer les répertoire que le spip_loader ne créer pas
mkdir plugins
@phenix-factory
phenix-factory / menu-lang.html
Last active September 14, 2016 11:41
SPIP: Menu lang linéaire pour SPIP 3
[(#REM) boucle menu langue pour les articles, on va simplement chercher les différentes traductions de l'article]
<B_article>
<ul class="lang text-center">
<BOUCLE_article(ARTICLES){id_article}{si #ID_ARTICLE|oui}>
<BOUCLE_traductions(ARTICLES){traduction} {par lang}>
[(#EXPOSE{
<li class="active"><a href="#" rel="alternate" class="active">#LANG</a></li>,
<li><a href="[(#URL_ARTICLE|parametre_url{lang,#LANG})]" rel="alternate">#LANG</a></li>
})]
</BOUCLE_traductions>
@phenix-factory
phenix-factory / balise_contante.php
Last active September 7, 2016 13:11
SPIP: une balise pour lire les constantes PHP dans les squelettes SPIP
<?php
// Balise spip pour lire les constantes PHP proprement
function balise_LIRE_CONSTANTE_dist($p) {
$constante = interprete_argument_balise(1, $p);
$p->code = "constant($constante)";
$p->interdire_scripts = false;
return $p;
}
@phenix-factory
phenix-factory / racine_spip.html
Last active September 7, 2016 07:59
SPIP: Menu racine SPIP (Zcore)
<ul[ id="(#ENV{id})"][ class="(#ENV{class,nav-main})"] role="menu">
[(#REM) Définir la class à utiliser pour EXPOSE ]
[(#SET{expose_class, #ENV{expose_class, on}})]
[(#SET{dropdown_class, #ENV{dropdown_class, dropdown}})]
[(#REM) Accueil du site ]
<li[ (#SI_PAGE{sommaire}|oui)class="#GET{expose_class}"]>
<a href="#URL_SITE_SPIP/" role="menuitem" [title="(#NOM_SITE_SPIP|attribut_html)"]>
<:zcore:accueil:>
</a>
@phenix-factory
phenix-factory / send_file_to_browser.php
Created August 5, 2016 13:07
PHP : envoyer un fichier au navigateur
<?php
$size = filesize($file);
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: '.$size);
@phenix-factory
phenix-factory / balise_chercher_logo_dist.php
Last active June 22, 2016 23:55
SPIP: Retrouver le logo d'un objet sans avoir a lancer tout le système de boucle.
<?php
/**
* #CHERCHER_LOGO{objet, id_objet}
* Retrouver le logo d'un objet sans avoir à lancé tout le système de boucle.
*
* @param mixed $p
* @access public
* @return mixed
*/
function balise_CHERCHER_LOGO_dist($p) {