Skip to content

Instantly share code, notes, and snippets.

View mrkpatchaa's full-sized avatar

Médédé Raymond KPATCHAA mrkpatchaa

View GitHub Profile
@mrkpatchaa
mrkpatchaa / README.md
Last active April 4, 2024 09:37
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@mrkpatchaa
mrkpatchaa / dequeue-styles-and-scripts.php
Created February 29, 2016 05:53
Dequeue Styles and Scripts In WordPress
<?php
/** From http://www.paulund.co.uk/dequeue-styles-scripts-wordpress */
/**
* Dequeue JavaScript or Stylesheet.
*/
function dequeue_script()
{
// Run the dequeue script with the handle of the JavaScript file
wp_dequeue_script( $handle );
@mrkpatchaa
mrkpatchaa / optimize-wordpress-code-styles.php
Created September 29, 2021 07:46
Block-styles loading enhancements in WordPress 5.8
add_filter('should_load_separate_core_block_assets', '__return_true');
// https://make.wordpress.org/core/2021/07/01/block-styles-loading-enhancements-in-wordpress-5-8/?source=korben.info
@mrkpatchaa
mrkpatchaa / git-export-changes-between-two-commits.md
Last active September 29, 2020 03:51
[Git command to export only changed files between two commits] #git

Use case : Imagine we have just created a project with composer create-project awesone-project (currently V0.2). 2 weeks later, there is a new release (V0.3). How to update your project ? Since composer update only updates the project dependencies, it is not what we are looking for. Composer doesn't know about awesome-project since it's not in our composer.json.

After trying many git solutions, I've come to this :

git archive --output=changes.zip HEAD $(git diff --name-only SHA1 SHA2 --diff-filter=ACMRTUXB)

This command will check for changes between the two commits and ignore deleted files.

@mrkpatchaa
mrkpatchaa / 0-jasascript-tricks.md
Last active August 5, 2020 13:52
Javascript Tricks

Some JavaScript Tricks

<html>
<style>
.overlay-image {
position: relative;
width: 900px;
height: 600px;
background: url(https://images.unsplash.com/photo-1565191999001-551c187427bb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1650&q=80) no-repeat center center fixed;
background-size: cover;
}
@mrkpatchaa
mrkpatchaa / wifi-password.sh
Last active June 29, 2020 06:29
Find WIFI Password #wifi
# Windows
netsh wlan show profile NOM_DU_RESEAU_WIFI key=clear
# Mac
security find-generic-password -wa NOM_DU_RESEAU_WIFI
# Linux
sudo cat /etc/NetworkManager/system-connections/NOM_DU_RESEAU_WIFI | grep psk=
# From https://korben.info/une-commande-pour-retrouver-en-clair-le-mot-de-passe-dun-reseau-wifi.html
@mrkpatchaa
mrkpatchaa / a11y-security.css
Last active June 29, 2020 06:28
Accessibility and security in CSS #css
/* Unsecure target _blank */
a[target$="blank"]:not([rel*="noopener"]):not([rel*="noreferrer"]) {
outline: 2px dotted red;
}
/* Links going nowhere */
a:is(:not([href]), [href=""], [href="#"]) {
outline: 2px dotted red;
}
@mrkpatchaa
mrkpatchaa / README.md
Created April 10, 2019 14:44
Git Detached Head

The intermediate steps of an interactive rebase are done with a detached HEAD (partially to avoid polluting the active branch’s reflog). If you finish the full rebase operation, it will update your original branch with the cumulative result of the rebase operation and reattach HEAD to the original branch. My guess is that you never fully completed the rebase process; this will leave you with a detached HEAD pointing to the commit that was most recently processed by the rebase operation.

To recover from your situation, you should create a branch that points to the commit currently pointed to by your detached HEAD:

git branch temp git checkout temp (these two commands can be abbreviated as git checkout -b temp)

This will reattach your HEAD to the new temp branch.

@mrkpatchaa
mrkpatchaa / Social Network Share Count
Created October 6, 2014 08:02
Getting Social Network Share Count from Facebook, Twitter, Pinterest, Linkedin, Google Plus, StumbleUpon
// Facebook Likes and Shares
$facebook_like_share_count = function ( $url ) {
$api = file_get_contents( 'http://graph.facebook.com/?id=' . $url );
$count = json_decode( $api );
return $count->shares;
};