Skip to content

Instantly share code, notes, and snippets.

View ahmadawais's full-sized avatar
Building the easiest way for developers to build AI products BaseAI.dev

Ahmad Awais ⌘ ahmadawais

Building the easiest way for developers to build AI products BaseAI.dev
View GitHub Profile
class EDD_Paddle_Webhook_Handler extends EDD_Webhook_Handler {
function get_hook_id() {
return 'paddle';
}
function get_hook_name() {
return 'Paddle';
}
function get_endpoint_args() {

Advanced JavaScript Learning Resources

This is a list of advanced JavaScript learning resources from people who responded to this [Tweet][13] and this [Tweet][20].

  • [You Don't Know JS][3]

  • [Frontend Masters courses by Kyle Simpson][12]

  • [@mpjme][6]'s [YouTube videos][5]

@yangshun
yangshun / using-eslint-with-prettier.md
Last active November 8, 2024 10:21
Comparison between tools that allow you to use ESLint and Prettier together.
prettier-eslint eslint-plugin-prettier eslint-config-prettier
What it is A JavaScript module exporting a single function. An ESLint plugin. An ESLint configuration.
What it does Runs the code (string) through prettier then eslint --fix. The output is also a string. Plugins usually contain implementations for additional rules that ESLint will check for. This plugin uses Prettier under the hood and will raise ESLint errors when your code differs from Prettier's expected output. This config turns off formatting-related rules that might conflict with Prettier, allowing you to use Prettier with other ESLint configs like eslint-config-airbnb.
How to use it Either calling the function in your code or via [prettier-eslint-cli](https://github.co
@websupporter
websupporter / upload-a-file.MD
Created June 15, 2017 14:34
Upload a file using the WordPress REST API

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:

@itzikbenh
itzikbenh / post.php
Last active October 18, 2016 04:48
Twitter share on text highlight. Inspired by theguardian.com. Tested on latest Chrome, Firefox, and Safari.
<!-- Add this anywhere in the page. It assumes your content is inside an <article> tag. -->
<a class="floating-twitter-share-link" href="#" title="Share this" target="_blank">
<i class="fa fa-twitter floating-twitter-share"></i>
</a>
@lukecav
lukecav / like-actions.js
Last active December 13, 2017 17:11
Simple Likes
jQuery( document ).ready( function ( $ ) {
$( document ).on( 'click', '.simple-like-btn', function( e ) {
e.preventDefault();
var like = {
'action' : $( this ).data( 'action' ),
'pid' : $( this ).data( 'pid' )
}
var likebtn = this;
$.post( ajax_object.ajax_url, like ).done( function( response ) {
response = JSON.parse( response );
@justintadlock
justintadlock / fonts.php
Last active July 13, 2016 15:15
Enqueue fonts in WP
<?php
/**
* Functions for handling font enqueueing, registration, etc. This works with the
* Google Fonts API.
*
* Extending an idea from Jose Castaneda. This is a small script for loading Google fonts
* with an easy method for adding/removing/editing the fonts loaded via child theme.
*
* @link http://blog.josemcastaneda.com/2016/02/29/adding-removing-fonts-from-a-theme/
*/
@bueltge
bueltge / RegularExpressionCheatSheet.md
Last active April 2, 2022 13:55
Regular Expression Cheat Sheet

Regular Expression Cheat Sheet - PCRE

Kudos/Source: https://github.com/niklongstone/regular-expression-cheat-sheet

Anchor Description Example Valid match Invalid
^ start of string or line ^foam foam bath foam
\A start of string in any match mode \Afoam foam bath foam
$ end of string or line finish$ finish finnish
\Z end of string, or char before last new line in any match mode finish\Z finish finnish
@subfuzion
subfuzion / curl.md
Last active May 13, 2025 18:51
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

<?php
/**
* Plugin Name: Deprecated admin_notices
* Description: Disable PHP Deprecated notices and display in admin_notices
* Author: Weston Ruter, XWP
*/
call_user_func( function() {
error_reporting( error_reporting() ^ E_DEPRECATED );