Skip to content

Instantly share code, notes, and snippets.

View evaisse's full-sized avatar

Emmanuel Vaïsse evaisse

  • none
  • Nancy, France
View GitHub Profile
@evaisse
evaisse / recolourize_plus.js
Created May 14, 2009 18:22
Recolourize Komodo edit syntax macro
/*
A komodo edit 5 macro script for coloring javascript, php
and css inside html
*/
try {
/**
* @type {Components.interfaces.ISciMoz}
*/
var v = ko.views.manager.currentView;
@evaisse
evaisse / rewrite.htaccess
Created June 25, 2009 12:31
HTACCESS REDIRECTION
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]
@evaisse
evaisse / remove_accents.function.php
Created August 18, 2009 07:43
php function to remove accent from the input string string. An example string like `ÀØėÿᾜὨζὅБю` * will be translated to `AOeyIOzoBY`
<?php # -*- coding: utf-8 -*-
// function remove_accents()
/**
* Unaccent the input string string. An example string like `ÀØėÿᾜὨζὅБю`
* will be translated to `AOeyIOzoBY`. More complete than :
* strtr( (string)$str,
* "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
* "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn" );
*
@evaisse
evaisse / bench.php
Created September 23, 2009 13:40
Bench function, just bench('flagname '.__LINE__) to set a flag, and bench() to get bench datas.
<?php #-*- coding:utf-8 -*-
# function bench()
/**
*
* @param string $label flag to markup your bench step
* @return mixed
* @example
bench('big ass code N#1 @ '.__LINE__);
// some code..
@evaisse
evaisse / codo language sample
Created October 9, 2009 12:05
codo language draft
id.getElementByName 'eddie'
Class Block.Struct
EndClass
Class Item.Model
@evaisse
evaisse / css-hacks.css
Created October 27, 2009 18:11
CSS HACK
* html {
/* will affect IE6 only */
}
*+html, * html {
/* will affect IE 7 and older version */
}
*+html {
/* will affect IE 7 only */
@evaisse
evaisse / email.php
Created November 12, 2009 17:26
html email php function
<?php #-*- coding: utf-8 -*-
/***
*
* @return bool true if email sent, false otherwise
*/
function email($to, $from, $subject, $html, $attachments=array(),
$bcc=false, $reply=false )
@evaisse
evaisse / password.php
Created December 11, 2009 11:07
Password generation
<?php
$pass = (chr((int)rand(97,122))).(chr((int)rand(67,90))).(rand(1000,9999));
<?php
// Start XML file, create parent node
$xml = new XMLWriter();
$xml->openMemory(); // create document in memory (AKA storing into a var)
$xml->setIndent(true); // autoindent output
$xml->setIndentString(' '); // set kind of indentation
$xml->startDocument('1.0','UTF-8'); // start xml declaration with encoding utf-8
@evaisse
evaisse / contact.php
Created January 29, 2010 12:02
validate email
<?php
$DESTINATAIRE = 'mon@adresse.com';
$SUJET = 'Message reçu depuis '.$_SERVER['HTTP_HOST'].' ';
function valid_email($email) {
$atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';
$domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)';
$regex = '/^' . $atom . '+' .