Skip to content

Instantly share code, notes, and snippets.

Avatar
📟
Recording videos for NodeCLI.com

Ahmad Awais ⚡️ ahmadawais

📟
Recording videos for NodeCLI.com
View GitHub Profile
@ahmadawais
ahmadawais / VSCode_Node_Babel_Recipe.md
Last active Sep 21, 2020
VSCode Node + Babel Recipe | Solves: vscode debug unexpected token import
View VSCode_Node_Babel_Recipe.md

VSCode Node + Babel Recipe

Debug Modern JavaScript with VSCode. Part of VSCode Course.

1. init a module:

npm init -y
@ahmadawais
ahmadawais / .eslintignore
Last active Sep 15, 2020
WP: Gutenberg ESLint
View .eslintignore
**/*.min.js
**/node_modules/**
**/vendor/**
build
coverage
cypress
node_modules
vendor
@ahmadawais
ahmadawais / flywheel-local-xdebug-vscode.md
Last active Sep 2, 2020
Debug WordPress with Visual Studio Code | VSCode WordPress Debug Setup | WordPress xDebug Setup for Local by FlyWheel with VSCode | Part of the VSCode Learning Course → https://VSCode.pro
View flywheel-local-xdebug-vscode.md

VSCode WordPress Debugging Setup: WordPress Xdebug Setup for Local by FlyWheel with VSCode


Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User

🚅 TL;DR

  • Make sure your Local by FlyWheel WordPress install is a custom install
@ahmadawais
ahmadawais / upload-a-file.MD
Created Jun 18, 2017 — forked from websupporter/upload-a-file.MD
Upload a file using the WordPress REST API
View upload-a-file.MD

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@ahmadawais
ahmadawais / no-follow-back-twitter.js
Created Aug 27, 2020
TWITTER: Remove the followers from twitter following tab to see the people who don't follow you back. Hacky as heck :P
View no-follow-back-twitter.js
document.querySelectorAll("div[role=\"button\"]").forEach(el => {
const follower = /Follows you/g.test(el.textContent);
follower && el.parentNode.parentNode.remove();
});
@ahmadawais
ahmadawais / .profile
Created Aug 27, 2020 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
View .profile
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
View gulpfile.js
/**
*
* Gulpfile setup
*
* @since 1.0.0
* @authors Ahmad Awais, @digisavvy, @desaiuditd, @jb510, @dmassiani and @Maxlopez
* @package neat
* @forks _s & some-like-it-neat
*/
View index.js
const visit = require('unist-util-visit')
module.exports = () => (tree, file) => {
visit(tree, 'heading', node => {
console.log('node: ', node);
visit(node, 'text', textNode => {
console.log('textNode: ', textNode);
const text = textNode.value ? textNode.value.trim() : ''
// const textNoWidows = text.replace(/\s+([\S]*)(\s*)$/gm, "\xA0$1$2");
View .babelrc
{
"presets": [
[ "env", {
"modules": false,
"targets": {
"browsers": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 iOS versions",
@ahmadawais
ahmadawais / .zshrc
Created Jul 26, 2020
🦄 Shades of Purple theme for fzf
View .zshrc
# fzf theme.
# Base16 Atelier Plateau Light
_gen_fzf_default_opts() {
local color00='#2D2B55'
local color01='#1E1E3F'
local color02='#A599E9'
local color03='#A599E9'
local color04='#A599E9'
local color05='#A599E9'
You can’t perform that action at this time.