Skip to content

Instantly share code, notes, and snippets.

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
@YohannParis
YohannParis / functions.less
Created January 30, 2013 19:54
List of all my useful functions I use in my LESS.
.clear {
&:before, &:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
}
&:after {
clear: both;
}
@YohannParis
YohannParis / session.php
Last active December 11, 2015 23:29
Session management to login somebody and attribute value to a session.
<?php
/* ============================================================================================ Initialisation ==== */
$msg = 'NO_ERROR'; // Variable for user feedback
/* ================================================================================================== Sessions ==== */
ini_set('session.use_only_cookies', true); // Starting the Session by using only cookies
session_start();
@YohannParis
YohannParis / verifCanada.php
Created January 31, 2013 15:29
Functions to check the right format for Phone Number, Postal Code and Email for Canada.
<?php
/* ====================================== North America Phone validation ==== */
function ValidatePhone($mValue){
$sPattern = '/^[\(]?[0-9]{3}[\)]?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/';
return preg_match($sPattern, $mValue);
}
/* ====================================== Canadian Code Postal validation ==== */
@YohannParis
YohannParis / emailForgetPassword.php
Created January 31, 2013 15:36
Basic email functions for registration system
<?php
// ================================================================================= //
// Email forgot password
// Arguments:
// - email: email address we try to verify
// - verificationNumber: number send to the user to compare
// ================================================================================= //
function emailPassword($email){
@YohannParis
YohannParis / quickStripeForm.php
Last active December 12, 2015 05:39 — forked from briancollins/gist:3098505
Quick and simple form to get started with Stripe. It doesn't handle all Stripe error feedback, but a good start.
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@YohannParis
YohannParis / verfiURL.php
Last active December 13, 2015 18:28
Validate URL in PHP with RegExp.
<?php
/* === URL validation
* [scheme] hostname [path] [file[getquery]] [#anchor]
* http://example.com/test/user.php?id=1234#details
*/
function validURL($url){
/* --- Scheme
@YohannParis
YohannParis / ga.html
Last active December 13, 2015 18:38
Google Analytics snippet optimization. Maybe don't do a big difference, but I liked leaner code.
<!--
Optimizing the asynchronous Google Analytics snippet
http://mathiasbynens.be/notes/async-analytics-snippet
-->
<script>
var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
@YohannParis
YohannParis / mailto.txt
Created March 7, 2013 20:01
mailto command to send pre-filled emails
RFC 2368: http://www.ietf.org/rfc/rfc2368.txt
mailto:name@domain.com?subject=Header&body=This is the first line%0D%0AThis is the second
%0D%0A = line break.
%20 = space, not really needed.
@YohannParis
YohannParis / center.css
Created July 5, 2013 15:43
To horizontally and vertically center an element in css: http://css-tricks.com/centering-percentage-widthheight-elements/
/*
* To horizontally and vertically center an element in css:
* http://css-tricks.com/centering-percentage-widthheight-elements/
*/
.center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);