Skip to content

Instantly share code, notes, and snippets.

@hqhow
hqhow / WordPress-coding-standard.md
Last active July 13, 2020 15:57
Write a WordPress Plugin - Checklist and Standards - HQHow.com

This collection on standards by HQHow.com

  • Escape, echo, sanitize,...validate input data
  • Every echo must include text-domain for the translation
  • If there's empty file, delete it
  • If there's the commented code, delete it on the production commit.
  • If you want to regist the resources file, like CSS or JS, you must pay attention to the - performance and how it will affect to user's site
  • For every output class name, they must have the plugin prefix, i.e InnoRef, the prefix should be inr-your-class-name
  • Try not to override the basic elements like a, b, strong, i....you will want to mantain the consistancy of the UI through out the website
  • If you want to call and run AJAX, you just do it via wp-ajax.php action, and must pay attention to logged in/out user case.
@eyarz
eyarz / commit-msg-hook.py
Last active December 15, 2021 17:57
Git commit-msg hook to verify commit message convention => https://datree.io/blog/git-commit-message-conventions-for-readable-git-log/
#!/usr/bin/env python
"""
Git commit hook:
.git/hooks/commit-msg
Check commit message according to guidelines
"""
import sys
import re
@manzoorwanijk
manzoorwanijk / README.md
Last active December 23, 2023 01:42
Google Script to bypass the blockage of Telegram Bot API from by webhost

WPTelegram Google Script

You can use this script to bypass the bans on Telegram API by different hosts. Simply send the request to this script instead of the Telegram Bot API after deploying it as a web app and allowing anonymous access.

Params

It accepts bot GET and POST requests with the following params

name type Description
# Converts a JSONL file generated with telegram-history-dump (1) to CSV
# Usage: python telegram-csv.py <path to json file> <path to output csv file>
# Example: python telegram-csv.py Bob.json Bob.csv
# 1: https://github.com/tvdstaaij/telegram-history-dump
from datetime import datetime
import unicodecsv as csv
import json, sys
def get_isodate(msg):
date = msg.get("date", None)
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active April 24, 2024 10:11
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@v0lkan
v0lkan / nginx.conf
Last active April 2, 2024 18:25
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@jvenator
jvenator / gist:9672772a631c117da151
Last active November 28, 2023 20:37
PDFtk Server Install Workaround for Mac OS X

Installing PDFtk Server edittion on your Mac

This workaround install is necessary because PDFtk was pulled from homebrew-cask due to issues with it aggressively overwriting file permissions that could impact other installed libraries. See this homebrew-cask issue.
The following steps worked on Mac OS X 10.10.1 with a standard brew installation for the PDFtk Mac OS X server libary version 2.02.
All Terminal commands separated by a full line space. Some commands wrap into multiple lines.

Download and extract the Mac OS X server install pacakge

@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {
@magnetikonline
magnetikonline / README.md
Last active November 27, 2023 21:12
Setting Nginx FastCGI response buffer sizes.
@rxaviers
rxaviers / gist:7360908
Last active April 25, 2024 01:12
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: