Skip to content

Instantly share code, notes, and snippets.

View Nann's full-sized avatar

Chalermchai Prompunya Nann

View GitHub Profile
@mikowl
mikowl / oneliners.js
Last active March 28, 2024 20:52
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@ankyit
ankyit / wordpress_install.info
Last active July 5, 2018 03:44
WordPress Installation
### Update the Server
apt-get update
apt-get upgrade
##Install webserver, PHP and MariaDB
apt-get install nginx php php-cli php-common php-curl php-dev php-fpm php-gd php-intl php-json php-mbstring php-mysql php-opcache php-readline php-soap php-xml php-zip mariadb-server
##Secure Maria DB and create database
mysql_secure_installation
mysql -i
@ahmadawais
ahmadawais / flywheel-local-xdebug-vscode.md
Last active May 3, 2024 12:07
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

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
@phlbnks
phlbnks / products_with_category.sql
Last active December 18, 2020 23:11
Select Product name, SKU, price and category from WordPress / WooCommerce with MySQL query
SELECT
wp_posts.post_title AS Product,
wp_postmeta1.meta_value AS SKU,
wp_postmeta2.meta_value AS Price,
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories
FROM wp_posts
LEFT JOIN wp_postmeta wp_postmeta1
ON wp_postmeta1.post_id = wp_posts.ID
AND wp_postmeta1.meta_key = '_sku'
LEFT JOIN wp_postmeta wp_postmeta2
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
<?php
/*
Plugin Name: Custom Registration Fields
Plugin URI:
Description:
Version: 0.1
Author: CSSIgniter
Author URI:
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@visibletrap
visibletrap / one-two-three.clj
Last active December 7, 2017 05:32
Input is a file contains html of comment section of this post https://www.facebook.com/roofimon.class/posts/10154689730497047
; :dependencies [[hickory "0.7.1"]]
(require '[clojure.pprint :refer [print-table]]
'[clojure.string :as string]
'[hickory.core :refer [as-hickory parse]]
'[hickory.select :as s])
(def choices #{"1 2 3" "2 3 1" "3 1 2" "1 3 2" "3 2 1" "2 1 3"})
(def meanings
@ozh
ozh / Facebook-xoxo-Congrats.md
Last active June 22, 2022 16:32
Facebook Congrats & Kisses animations

Hearts & kisses :

  • xo
  • xoxo
  • xoxoxo
  • Besos y abrazos
  • bisou
  • bisous
  • baci
  • 꽁냥꽁냥
@mennwebs
mennwebs / .htaccess
Last active January 1, 2018 05:17
force HTTPS - เพิ่มไว้บนสุดของไฟล์ได้เลย
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]