Skip to content

Instantly share code, notes, and snippets.

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

sachyya sachyya

🏠
Working from home
View GitHub Profile
@ericandrewlewis
ericandrewlewis / a.md
Last active October 27, 2020 18:44
The WordPress Customizer

The WordPress Customizer

The WordPress Customizer is an interface for drafting changes to content while previewing the changes before they are saved. This is an alternative to the "save and suprise" model of changing settings without knowing what exactly will happen.

The customizer can be accessed in the admin interface under Appearance > Customize.

A screenshot of the customizer

#19909 is the trac ticket that introduced the Customizer during the 3.4 release cycle.

@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@davidakennedy
davidakennedy / a11y-theme-review.txt
Created February 14, 2016 21:37
A collection of review template responses for WordPress theme reviews.
Hi there!
Thanks for creating a WordPress theme and submitting it to the WordPress.org directory! Since your theme also includes the accessibility-ready tag, I've also reviewed it according to those requirements, which you can find here: https://make.wordpress.org/themes/handbook/review/accessibility/
Required
Anything in this section will need to be fixed before the theme can be approved.
Keyboard Navigation
( function( api ) {
'use strict';
// Add callback for when the header_textcolor setting exists.
api( 'header_textcolor', function( setting ) {
var isHeaderTextDisplayed, linkSettingValueToControlActiveState;
/**
* Determine whether the site title and tagline should be displayed.
*

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@ahmadawais
ahmadawais / dev_and_production.txt
Last active July 24, 2018 17:54
Gutenberg: v0.50.0 — Cost of Modules — Data Calculation through: https://github.com/siddharthkp/cost-of-modules
cost-of-modules --include-dev --no-install
Calculating...
┌───────────────────────────────────────────┬──────────────┬─────────┐
│ name │ children │ size │
├───────────────────────────────────────────┼──────────────┼─────────┤
│ babel-preset-env │ 147 │ 81.98M │
├───────────────────────────────────────────┼──────────────┼─────────┤
@ericandrewlewis
ericandrewlewis / index.md
Last active January 27, 2019 00:47
Scroll to the rock bottom of a website

Scroll to the rock bottom of a website

Throw the script below in the browser's JS console.

It moves the viewport to the bottom of the page repeatedly with a delay in between. This is useful when the page loads data via infinite scroll and you want to do something with all the data.

const atPageBottom = () => {
  const scrolled = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
  const documentHeightMinusOneViewport =
@pento
pento / php-block.js
Last active February 29, 2024 01:31
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@jan-koch
jan-koch / remove-woo-scripts.php
Created February 28, 2020 09:14
Remove WooCommerce related resources except on WooCommerce-based pages (products, cart, checkout, etc). Use on a testing environment before pasting this into your live website!
/**
* This code snippet removes JavaScript and CSS files loaded from WooCommerce if they are not necessary.
*
* Please test this on a staging copy of your website before putting this into the functions.php of your live website.
*/
add_action( 'wp_enqueue_scripts', 'my_remove_woo_assets', 99 );
function my_remove_woo_assets() {
if ( function_exists( 'is_woocommerce' ) ) { // Check if Woo is installed.
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { // Only run on non-Woo pages.
// Remove unnecessary stylesheets.