Skip to content

Instantly share code, notes, and snippets.

View Antoinebr's full-sized avatar
:octocat:
🔥

Antoinebr

:octocat:
🔥
View GitHub Profile
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char* ssid = "myWifiSSID";
const char* password = "myWifiPassWord";
ESP8266WebServer server(80);
@Antoinebr
Antoinebr / ESP8266 WiFi.c++
Created August 27, 2017 16:12
ESP8266 WiFi
/*
* ESP8266 (WeMosD1) WiFi Relay Control
*
* learnelectronics
* 05 JUN 2017
*
* www.youtube.com/c/learnelectronics
* arduino0169@gmail.com
* https://www.youtube.com/watch?v=3bFs_MZVFxw
*/
@Antoinebr
Antoinebr / app.js
Last active July 26, 2017 19:24
node mysql db connect and record
var dataBase = require('./db.js');
/*
* Instatiations
*/
var db = new dataBase();
try {
@Antoinebr
Antoinebr / nginx-gzip-browser-caching.conf
Last active February 16, 2017 10:13
browser-caching / Gzip
#
# Gzip Config
#
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
#
# Browser Caching config
#
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
@Antoinebr
Antoinebr / defer-inline-js.html
Last active June 13, 2018 06:47
Tell inlines scripts to wait, that a function is defined https://goo.gl/DF6fWn
<!-- Put this function inline on the header -->
<script>
function whenAvailable(name, callback) {
var interval = 10; // ms
window.setTimeout(function() {
if (window[name]) {
callback(window[name]);
} else {
window.setTimeout(arguments.callee, interval);
}
@Antoinebr
Antoinebr / defer-wp-scripts.php
Last active December 20, 2017 07:24
defer-wp-scripts.php
<?php
/*
function to add async and defer attributes
Will only work if the scripts are enqueued with wp_enqueue_script()
*/
function defer_js_async($tag){
## 1: list of scripts to defer.
$scripts_to_defer = array(
'owl-carousel.min.js',
@Antoinebr
Antoinebr / .htaccess
Last active April 23, 2018 17:05
htaccess GZIP
# Gzip compression
<IfModule mod_deflate.c>
# Active compression
SetOutputFilter DEFLATE
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
@Antoinebr
Antoinebr / myhooks.php
Last active August 8, 2018 14:08
loadCss with WordPress example with WooCommerce
<?php
// #1 We register LoadCss script, and we load it in the footer
// LoadCss is here -> https://github.com/filamentgroup/loadCSS/blob/master/src/loadCSS.js
add_action( 'wp_enqueue_scripts', 'register_my_scripts' );
function register_my_scripts() {
wp_enqueue_script( 'loadCss', get_template_directory_uri() . '/js/libs/loadCss.js',false, '1.2.1', true );
}
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
@Antoinebr
Antoinebr / inside-loop.php
Last active May 19, 2020 15:54
Hook to use lazysize lib
// The lazyoad class is added
<?php the_post_thumbnail('medium', array('class' => "img-responsive lazyload")); ?>