Skip to content

Instantly share code, notes, and snippets.

View guydumais's full-sized avatar
💬
Learn / Test / Apply

Guy Dumais guydumais

💬
Learn / Test / Apply
View GitHub Profile
@guydumais
guydumais / express-js-server.js
Last active March 6, 2021 14:54
Express HTTP Server
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
@guydumais
guydumais / node-js-server.js
Created March 6, 2021 14:48
Node.js HTTP Server
require('http');
const hostname = 'localhost';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
@guydumais
guydumais / Breakpoints
Created December 16, 2020 10:13 — forked from janily/Breakpoints
Mobile-first CSS Media Queries Breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@guydumais
guydumais / PortSwitch.php
Created July 1, 2020 02:20 — forked from bueltge/PortSwitch.php
Port switch to get an workaround to use WordPress Multisite also without the default port 80.
<?php # -*- coding: utf-8 -*-
declare( strict_types = 1 );
/**
* Plugin Name: Port Switch
* Plugin URI: https://gist.github.com/bueltge/51013ab809f5f0f5e305c70c2d393fff
* Description: Port switch to get an workaround to use WordPress Multisite also without the default port 80.
* Version: dev
* Author: Frank Bültge
* Author URI: https://bueltge.de
* License: MIT
@guydumais
guydumais / wpcom-open-graph.php
Created June 21, 2020 10:18 — forked from mjangda/wpcom-open-graph.php
Add Open Graph tags to your WordPress site
<?php
/**
* Open Graph Tags
*
* Add Open Graph tags so that Facebook (and any other service that supports them)
* can crawl the site better and we provide a better sharing experience.
*
* @link http://ogp.me/
* @link http://developers.facebook.com/docs/opengraph/
*/
@guydumais
guydumais / functions.php
Created May 8, 2020 10:34 — forked from butlerblog/functions.php
SMTP using wp-config.php for settings
<?php // Don't use this line.
/**
* This function will connect wp_mail to your authenticated
* SMTP server. This improves reliability of wp_mail, and
* avoids many potential problems.
*
* For instructions on the use of this script, see:
* https://www.butlerblog.com/2013/12/12/easy-smtp-email-wordpress-wp_mail/
*
@guydumais
guydumais / functions.php
Last active March 23, 2021 01:04
WordPress ➧ Désactiver jQuery Migrate dans WordPress
<?php
/**
* Désactiver jQuery Migrate dans WordPress.
*
* @author Guy Dumais.
* @link https://guydumais.digital//fr/blog/desactiver-jquery-migrate-dans-wordpress/
*/
add_filter( 'wp_default_scripts', $af = static function( &$scripts) {
if(!is_admin()) {
$scripts->remove( 'jquery');
@guydumais
guydumais / functions.php
Last active April 30, 2020 07:07
WordPress ➧ Disable jQuery Migrate in WordPress
<?php
/**
* Disable jQuery Migrate in WordPress.
*
* @author Guy Dumais.
* @link https://en.guydumais.digital/disable-jquery-migrate-in-wordpress/
*/
add_filter( 'wp_default_scripts', $af = static function( &$scripts) {
if(!is_admin()) {
$scripts->remove( 'jquery');
@guydumais
guydumais / functions.php
Last active October 25, 2021 16:42
WordPress ➧ Change Locale Dynamically in WordPress
/**
* Change Locale Dynamically in WordPress.
*
* @author Guy Dumais.
* @link https://en.guydumais.digital/change-locale-dynamically-in-wordpress/
*/
// Filters all language attributes in the html tag.
add_filter( 'language_attributes', $af = function( $output, $doctype ) {
@guydumais
guydumais / functions.php
Last active July 22, 2017 06:52
WordPress ➧ Changer le code de langue WordPress dynamiquement
/**
* Changer le code de langue WordPress dynamiquement.
*
* @author Guy Dumais.
* @link https://guydumais.digital/changer-le-code-de-langue-wordpress-dynamiquement/
*/
// Filtrer les attributs de langue dans la balise html.
add_filter( 'language_attributes', $af = function( $output, $doctype ) {