Skip to content

Instantly share code, notes, and snippets.

View ShahriarKh's full-sized avatar

Shahriar ShahriarKh

View GitHub Profile

Cheat Sheet

This cheatsheet is organized not by typescript concept- but by programming concept, making it easy to find what you need without knowing what it's called in Typescript. ie Sections are broken into "Objects","Arrays", and "Functions"

Extended examples are included- but often they are more explicit than needed. Your code will often be much more simple.

Obje

add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'myplugin/myplugin-admin-page.php', 'myplguin_admin_page', 'dashicons-tickets', 6 );
}
@colinhacks
colinhacks / log_json_shortcuts.json
Created January 16, 2022 23:50
VSCode shortcuts for console.log and JSON.stringify
// keybindings.json
// Command Pallette > Open Keyboard Shortcuts (JSON)
[
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(${TM_SELECTED_TEXT}$1)$0;"
@danielwetan
danielwetan / nodejs-cicd-github-actions.md
Last active April 13, 2025 18:55
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@jamesgmarks
jamesgmarks / gist:56502e46e29a9576b0f5afea3a0f595c
Last active February 5, 2025 20:55
MySQL/MariaDB BIN_TO_UUID and UUID_TO_BIN Polyfill
DELIMITER //
CREATE FUNCTION BIN_TO_UUID(b BINARY(16))
RETURNS CHAR(36)
BEGIN
DECLARE hexStr CHAR(32);
SET hexStr = HEX(b);
RETURN LOWER(CONCAT(
SUBSTR(hexStr, 1, 8), '-',
SUBSTR(hexStr, 9, 4), '-',
@termitkin
termitkin / functions.php
Created September 16, 2019 13:21
[WordPress] Allow to upload .rar files
function allow_upload_rar ($mime_types = array()) {
$mime_types['rar'] = 'application/x-rar';
return $mime_types;
}
add_filter('upload_mimes', 'allow_upload_rar');
@Oranzh
Oranzh / AES-256 encryption and decryption in PHP and C#.md
Created March 24, 2018 04:19
AES-256 encryption and decryption in PHP and C#

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';
@Mohamed3on
Mohamed3on / batchPrettier.md
Last active January 7, 2025 03:23
Run prettier on all JS files in a directory
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
@afig
afig / customBadges.md
Last active April 10, 2025 17:36
Creating a Custom Badge for GitHub Projects

Custom Badges

The Shields service (at shields.io) provides a way to create custom badges for your projects. These are badges are very common and are frequently used to show status information about the project, or demonstrate tools that were used for the development of your project.

Example badge:

Creating a badge

{
"flowerlist": [
{
"category": "Shrubs",
"price": 15.99,
"instructions": "Large double. Good grower, heavy bloomer. Early to mid-season, acid loving plants. Plant in moist well drained soil with pH of 4.0-5.5.",
"photo": "california_snow.jpg",
"name": "Azalea",
"productId": 1
},