Skip to content

Instantly share code, notes, and snippets.

Avatar

okcharlo charleslouis

View GitHub Profile
@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active Oct 13, 2022
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
View custom-search-acf-wordpress.php
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
@charleslouis
charleslouis / .gitlab-ci-npm.yml
Last active Mar 13, 2022
deploy-gitlab-2-linode.md , gitlab, deploy, PROJ_OWNER , DEPLOY_DIR, .gitlab-ci.yml
View .gitlab-ci-npm.yml
deploy-prod:
variables:
GIT_STRATEGY: none
stage: deploy
only:
- master
script:
- sudo -u $PROJ_OWNER git --git-dir=$DEPLOY_DIR/.git --work-tree=$DEPLOY_DIR fetch origin $CI_COMMIT_REF_NAME
- sudo -u $PROJ_OWNER git --git-dir=$DEPLOY_DIR/.git --work-tree=$DEPLOY_DIR reset --hard FETCH_HEAD
- sudo -H -u $PROJ_OWNER chmod u+x $DEPLOY_DIR/nodescripts.sh
@charleslouis
charleslouis / use-custom-post-type-dedicated-template.php
Created May 10, 2013
php - wordpress - customp post type - force usage of dedicated template for custom post type
View use-custom-post-type-dedicated-template.php
/*=======================================================================
= force dedicated template usage for custom posts =
=======================================================================*/
add_filter( 'template_include', 'include_template_function', 1 );
function include_template_function( $template_path ) {
if ( get_post_type() == 'fiche-projet' ) {
if ( is_single() ) {
// checks if the file exists in the theme first,
@charleslouis
charleslouis / cheatsheet.md
Last active Oct 12, 2019
Cheat sheet CLI Zsh bash
View cheatsheet.md

Vim

-ci' - change inside the single quotes -ciw - change inside a word -ci( - change inside parentheses -dit - delete inside an HTML tag, etc -80i * ^[ make a line of 80* -fn12 = nohls -:FZF to bring FuzzyFile -^N to open NerdTree

View hero-youtube-full-bg-video.scss
$banner-play-button-background: $primary-color;
$banner-play-button-background-hover: $secondary-color;
$banner-play-button-box-shadow: 0 0 1px 0 rgba(80, 85, 103, 0.39),0 7px 9px 0 rgba(94, 94, 94, 0.18);
$banner-play-button-size: 5rem;
$banner-play-button-background-size: 40%;
$banner-play-button-background-position: 55% center;
$banner-play-button-color: $white;
$banner-play-button-image: url('assets/images/graphics/icone-play.svg');
$hero-bg-color: $light-gray;
@charleslouis
charleslouis / add_custom_gravatar.php
Created May 9, 2013
php - wordpress - custom default Gravatar + localhost support hack
View add_custom_gravatar.php
/* AVATAR */
// Add a default avatar to Settings > Discussion
add_filter( 'avatar_defaults', 'add_custom_gravatar' );
if ( !function_exists('add_custom_gravatar') ) {
function add_custom_gravatar( $avatar_defaults ) {
$myavatar = get_stylesheet_directory_uri() . '/_inc/img/avatar.png';
$avatar_defaults[$myavatar] = 'Avatar Santé Ensemble';
return $avatar_defaults;
@charleslouis
charleslouis / guide-icon-creation.txt
Last active Feb 27, 2019
PHP - Wordpress - embed favicon and touch icons
View guide-icon-creation.txt
Créer les icones suivantes en respectant les noms et dimensions des images :
name = "favicon.png" - size="16x16"
name = "favicon.ico" - size="16x16"
<!-- For third-generation iPad with high-resolution Retina display: -->
name = "apple-touch-icon-144x144-precomposed.png" - size="144x144"
<!-- For iPhone with high-resolution Retina display: -->
name = "apple-touch-icon-114x114-precomposed.png" - size="114x114"
@charleslouis
charleslouis / clean_var_dump.php
Created Oct 31, 2018
Une var_export() + colors instead of var_dum() for pretty dump
View clean_var_dump.php
// src: https://stackoverflow.com/questions/19816438/make-var-dump-look-pretty
<?php
highlight_string("<?php\n\$item =\n" . var_export($item, true) . ";\n?>");
@charleslouis
charleslouis / clear.txt
Created Sep 22, 2018 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
View clear.txt
watchman watch-del-all && rm -rf node_modules/ && npm install --cache /tmp/empty-cache && npm start --reset-cache
View addClassToBodyOnscroll.js
export function addClassToBodyOnscroll(elementReference) {
let timer;
const mainNav = $(elementReference);
const mainNavH = mainNav.outerHeight();
console.group('scrollTop');
console.log('mainNavH', mainNavH);
console.groupEnd();
$(window).scroll(function() {