Skip to content

Instantly share code, notes, and snippets.

View saidqb's full-sized avatar
🏠
Working from home

Muh Nurul Khomsa saidqb

🏠
Working from home
View GitHub Profile
@saidqb
saidqb / meta-tags.md
Created December 16, 2023 14:06 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@saidqb
saidqb / tailwind.config.js
Created November 4, 2023 15:38 — forked from sebmellen/tailwind.config.js
A tailwind.config.js file with the full color palette of Tailwind CSS 2.0, which I couldn't find available elsewhere. As of 2020-12-22, this config file works properly. Note that it will significantly increase the bundle size of your unpurged tailwind.css file!
// NOTE: AS REQUESTED, TAILWIND CSS 3.0 HAS FULL SUPPORT FOR ALL COLORS BY DEFAULT
// SEE https://tailwindcss.com/blog/tailwindcss-v3#every-color-out-of-the-box.
// As of 2020-12-22, this tailwind.config.js file includes all colors
// from the Tailwind CSS color palette reference laid out in full at this
// link: https://tailwindcss.com/docs/customizing-colors#color-palette-reference.
// Note that this will increase your unpurged Tailwind CSS file size immensely,
// for me it went from 3.64MB to 7.62MB! Be sure to purge your CSS in production!
// First we import the tailwindcss/colors dependency, as referenced
@saidqb
saidqb / database.php
Created March 16, 2022 11:00 — forked from andyfleming/database.php
Database config for laravel/lumen
<?php
return [
'default' => 'accounts',
'connections' => [
'accounts' => [
'driver' => 'mysql',
@saidqb
saidqb / wpdb-transactions
Created September 13, 2020 01:23 — forked from nciske/wpdb-transactions
MySQL database transaction, using the WordPress database object $wpdb. Requires the InnoDB table format.
<?php
global $wpdb;
// Start Transaction
$wpdb->query( "START TRANSACTION" );
// Do some expensive/related queries here
//$wpdb->query("DELETE FROM table WHERE form_id = '1' ");
//$wpdb->query("DELETE FROM data WHERE form_id = '1' ");
// set $error variable value in error handling after $wpdb modifications
@saidqb
saidqb / short-number-format.php
Created August 13, 2020 07:13 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@saidqb
saidqb / font-awesome.js
Created August 9, 2020 12:21 — forked from gbertb/font-awesome.js
How to load Font Awesome asynchronously
<!--
How to load Font Awesome asynchronously
Use: Just put this script on the bottom/footer of your web
-->
<script type="text/javascript">
(function() {
var css = document.createElement('link');
css.href = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css';
@saidqb
saidqb / disable-automatic-image-crop.php
Created July 14, 2020 01:49 — forked from czenzel/disable-automatic-image-crop.php
Wordpress - Disable Automatic Image Cropping
<?php
/*
Plugin Name: Disable Automatic Image Crop
Author: Wordpress Community
Description: wpse124009 - http://wordpress.stackexchange.com/questions/124009/why-wordpress-automatic-cropping-all-my-images and https://developer.wordpress.org/reference/functions/remove_image_size/
*/
add_action( 'init', 'czc_disable_extra_image_sizes' );
add_filter( 'image_resize_dimensions', 'czc_disable_crop', 10, 6 );
@saidqb
saidqb / ajax-action.php
Created June 1, 2020 03:26 — forked from danielpataki/ajax-action.php
Uploading With WordPress
add_action( 'wp_ajax_nopriv_submit_content', 'my_submission_processor' );
add_action( 'wp_ajax_submit_content', 'my_submission_processor' );
function my_submission_processor() {
// Handle the form in here
}
@saidqb
saidqb / WP-HTML-Compression
Created March 18, 2019 23:42 — forked from sethbergman/WP-HTML-Compression
Minify HTML for WordPress without a Plugin - Add to function.php
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
@saidqb
saidqb / wp-remove-default-image-sizes.php
Created January 28, 2019 15:05 — forked from iftee/wp-remove-default-image-sizes.php
Custom filter to remove default image sizes (WordPress and WooCommerce) from your theme.
<?php
/*
* Custom filter to remove default image sizes from WordPress.
*/
/* Add the following code in the theme's functions.php and disable any unset function as required */
function remove_default_image_sizes( $sizes ) {
/* Default WordPress */
unset( $sizes[ 'medium' ]); // Remove Thumbnail (150 x 150 hard cropped)