Skip to content

Instantly share code, notes, and snippets.

View w-jerome's full-sized avatar
💻
coding…

Jérôme Wohlschlegel w-jerome

💻
coding…
View GitHub Profile
@w-jerome
w-jerome / gravity-forms-markup.php
Last active August 2, 2020 14:02
WordPress — Markup Gravity Forms
<?php
/*
* Documentation :
* https://docs.gravityforms.com/
* https://gravitywiz.com/gravity-forms-hook-reference/
*/
// On execute ce code sinon il fait les modifications également quand on est dans le panneau d'administration
if (!is_admin()) {
@w-jerome
w-jerome / get-window-size.js
Created June 28, 2018 12:18
Javascript — Get Window Size
// http://ryanve.com/lab/dimensions/
document.documentElement.clientWidth
window.innerWidth
window.outerWidth
window.screen.width
window.screen.availWidth
$(document).width() 1552
document.body.clientWidth 1080
@w-jerome
w-jerome / mobile-browser-urlbar-height.js
Created June 19, 2018 17:14
Javascript — Mobile Browser URL Bar Height
var mobile_browser_urlbar_height = window.innerHeight - document.documentElement.clientHeight;
console.log(mobile_browser_urlbar_height)
@w-jerome
w-jerome / shortcode-gallery-images-links.php
Last active June 18, 2018 12:09
WordPress PHP - Shortcode Gallery Images Links
@w-jerome
w-jerome / .htaccess
Created June 13, 2018 13:17
Regex — Tips
# https://fr.wikipedia.org/wiki/Expression_r%C3%A9guli%C3%A8re
# [^liste] Un caractère n'étant pas entre crochets ("classe de caractères")
# ([^/]+) prend tout les caractères jusqu'au prochain slash
# /actualites/international/the-world-change-now-with-regex
^/actualites/([^/]+)/([^/]+)$
@w-jerome
w-jerome / is-in-viewport.js
Created June 8, 2018 10:21
Javascript — Is in viewport
function isInViewport (el) {
var rect = el.getBoundingClientRect();
return (
rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ||
rect.left < 0 && rect.right >= 0 ||
rect.left >= 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) ||
rect.top >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) ||
rect.top < 0 && rect.bottom >= 0 ||
rect.top >= 0 && rect.top < (window.innerHeight || document.documentElement.clientHeight)
@w-jerome
w-jerome / is-mobile.php
Created June 7, 2018 08:54
PHP — Detect is mobile
$is_mobile = false;
if (preg_match('/(android|webos|avantgo|iphone|ipad|ipod|blackberry|iemobile|bolt|boost|cricket|docomo|fone|hiptop|mini|opera mini|kitkat|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $_SERVER['HTTP_USER_AGENT'])) {
$is_mobile = true;
}
@w-jerome
w-jerome / .htaccess
Created June 1, 2018 09:25 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@w-jerome
w-jerome / threejs-tweenmax.js
Created May 22, 2018 12:00
Javascript — ThreeJS Animation with Tween
// Setup the animation loop.
function animate(time) {
requestAnimationFrame(animate);
TWEEN.update(time);
}
requestAnimationFrame(animate);
@w-jerome
w-jerome / facebook-messenger.html
Created May 17, 2018 15:13
Facebook Messenger
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.12'
});
};