Skip to content

Instantly share code, notes, and snippets.

View charleslouis's full-sized avatar

okcharlo charleslouis

View GitHub Profile
@charleslouis
charleslouis / composer-private-package-github-token.md
Created July 24, 2018 06:55 — forked from jeffersonmartin/composer-private-package-github-token.md
Generate a GitHub Personal Access Token for Private Composer Packages

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.

@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?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 / record-custom-post-type-in-buddyPress-activity.php
Created May 10, 2013 11:28
php - wordpress - buddy press - record custom post type in activity
/*============================================================
= record custom post types in activity =
============================================================*/
add_action( 'save_post', 'record_activity', 10, 2 );
function record_activity( $post_id, $post, $user_id = false ) {
global $bp, $wpdb;
$post_id = (int)$post_id;
@charleslouis
charleslouis / .gitlab-ci-npm.yml
Last active March 13, 2022 22:35
deploy-gitlab-2-linode.md , gitlab, deploy, PROJ_OWNER , DEPLOY_DIR, .gitlab-ci.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 11:29
php - wordpress - customp post type - force usage of dedicated template for custom post type
/*=======================================================================
= 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 October 12, 2019 06:37
Cheat sheet CLI Zsh bash

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

$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 13:31
php - wordpress - custom default Gravatar + localhost support hack
/* 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 February 27, 2019 11:28
PHP - Wordpress - embed favicon and touch icons
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 October 31, 2018 05:53
Une var_export() + colors instead of var_dum() for pretty dump
// src: https://stackoverflow.com/questions/19816438/make-var-dump-look-pretty
<?php
highlight_string("<?php\n\$item =\n" . var_export($item, true) . ";\n?>");