Skip to content

Instantly share code, notes, and snippets.

View washaweb's full-sized avatar

Washaweb washaweb

View GitHub Profile
@washaweb
washaweb / email-validation.js
Last active March 6, 2020 09:38
Email validation
const re = /^\w+([-+.'][^\s]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
let myEmail = 'toto@tata.com';
let emailFormat = re.test( myEmail );
//retourne un boolean true/false
//si l'expression régulière n'est pas validée sur le contenu de la valeur du champ email...
if (!emailFormat) {
//declenche une erreur
}
@washaweb
washaweb / angular-cheatsheet.md
Last active October 2, 2018 14:52
Angular Cheatsheet

Aide mémoire ANGULAR

Binding :

{{ maVariable }}

<p [title]="{'Mon titre': condition }">titre bindé par une variable</p>

Two Way Binding (attention: le module FormsModule doit être chargé dans app.module.ts )

@washaweb
washaweb / bs4-form-login.html
Created September 20, 2018 08:43
Formulaire de connexion de base
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Form verification</title>
@washaweb
washaweb / index.html
Created September 19, 2018 08:43
Exercice Event 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Exercice Event mouseover-mouseout</title>
<style>
h1 {
padding: 40px;
@washaweb
washaweb / cours Event
Created September 19, 2018 08:34
Cours (incomplet) sur les événements en JavaScript
/*
**JavaScript est un langage événementiel** : le développeur a un contrôle limité sur le flux d'exécution du code, qui est déterminé principalement par les interactions avec l'environnement. Un 'event', est comme son nom l'indique l'événement qui se déclenche lors d'une interaction.
**Exemple d'events :** Activation d'un lien, clic/double-clic sur un élément, mouvement de la souris, chargement du contenu du document, modification d'un input/select de formulaire, soumission d'un formulaire, appui sur une touche du clavier de l'utilisateur…
Le développeur peut intercepter des events et s'en servir pour déclencher une fonction selon que cet evenement s'est produit ou non. Il peut aussi créer ses propres évenements.
**plusieurs niveau de gestion des events, et donc plusieurs syntaxes...**
* DOM niveau 0 (standard de facto) -> la plus largement supportée
@washaweb
washaweb / keybase.md
Created February 24, 2017 11:05
keybase.md

Keybase proof

I hereby claim:

  • I am washaweb on github.
  • I am jeromeposlednik (https://keybase.io/jeromeposlednik) on keybase.
  • I have a public key whose fingerprint is C72A A3D4 1133 CA79 009B 288E CCFE DBE4 7DD7 FAD2

To claim this, I am signing this object:

@washaweb
washaweb / Wordpress - remove the 'Category:' prefix
Last active April 14, 2016 17:43
Rebuild the title for all the variants used in the original get_the_archive_title() function in order to remove or change the prefixes.
// Return an alternate title, without prefix, for every type used in the get_the_archive_title().
add_filter('get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>';
} elseif ( is_year() ) {
$title = get_the_date( _x( 'Y', 'yearly archives date format' ) );
@washaweb
washaweb / CSS Background gradient animation
Created March 22, 2016 14:55
CSS Background gradient animation
background: linear-gradient(146deg, #001156, #cf3dd7, #0294bf);
background-size: 600% 600%;
-webkit-animation: gradientAnimation 48s ease infinite;
-moz-animation: gradientAnimation 48s ease infinite;
-o-animation: gradientAnimation 48s ease infinite;
animation: gradientAnimation 48s ease infinite;
@-webkit-keyframes gradientAnimation {
0%{background-position:1% 0%}
50%{background-position:99% 100%}
100%{background-position:1% 0%}
@washaweb
washaweb / Wordpress - custom login page image
Last active April 14, 2016 17:43
Change the Wordpress logo image on Wordpress login page
/**
*
* Change custom login logo
*/
function custom_login_title() {
return get_option('blogname');
}
function custom_login_logo() {
echo '<style type="text/css">
@washaweb
washaweb / Owl Carousel 2 sync with loop and autoplay
Created March 22, 2016 09:28
1 big image carousel + 1 thumbnail navigation carousel synced