Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Screen recorder</title>
</head>
<body>
<button id="recording-toggle">Start recording</button>
<script defer>
/* https://go.tacodewolff.nl/minify */
enScroll=!1,enFdl=!1,extCurrent=void 0,filename=void 0,targetText=void 0,splitOrigin=void 0;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{},extensions=["pdf","xls","xlsx","doc","docx","txt","rtf","csv","exe","key","pps","ppt","pptx","7z","pkg","rar","gz","zip","avi","mov","mp4","mpe","mpeg","wmv","mid","midi","mp3","wav","wma"];function a(e,t,n,o){const j="G-XXXXXXXXXX",r=()=>Math.floor(Math.random()*1e9)+1,c=()=>Math.floor(Date.now()/1e3),F=()=>(sStor._p||(sStor._p=r()),sStor._p),E=()=>r()+"."+c(),_=()=>(lStor.cid_v4||(lStor.cid_v4=E()),lStor.cid_v4),m=lStor.getItem("cid_v4"),v=()=>m?void 0:enScroll==!0?void 0:"1",p=()=>(sStor.sid||(sStor.sid=c()),sStor.sid),O=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},a="1",g=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +a,sSto
@nikola-wd
nikola-wd / CommentFormProcessing.php
Last active March 12, 2023 20:11
Wordpress AJAX comment form in vanilla JS (es6) + axios (Comment submission without page refresh)
<?php
add_action( 'wp_ajax_ajaxcomments', 'ugwps_submit_ajax_comment' ); // wp_ajax_{action} for registered user
add_action( 'wp_ajax_nopriv_ajaxcomments', 'ugwps_submit_ajax_comment' ); // wp_ajax_nopriv_{action} for not registered users
function ugwps_submit_ajax_comment(){
$comment = wp_handle_comment_submission( wp_unslash( $_POST ) );
if ( is_wp_error( $comment ) ) {
$error_data = intval( $comment->get_error_data() );
if ( ! empty( $error_data ) ) {
wp_die( '<p>' . $comment->get_error_message() . '</p>', __( 'Comment Submission Failure' ), array( 'response' => $error_data, 'back_link' => true ) );
@samkent
samkent / dequeue-tribe-events-styles-scripts.php
Last active April 29, 2024 22:17
Dequeue Tribe Events (The Events Calendar) scripts and styles if not calendar or event page
<?php
/**
* Detect Tribe Events page
* @link https://wordpress.stackexchange.com/questions/340515/writing-a-function-to-detect-an-event
*/
function is_tribe_calendar() {
if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' )) {
return true;
}
else {
@steve10287
steve10287 / get_template_url.php
Created December 8, 2017 12:00
Wordpress get page template url
function get_template_page_url($template_name) {
$page_permalink = "";
$page = get_pages( array(
'meta_key' => '_wp_page_template',
'meta_value' => $template_name
) );
if ( ! empty( $page ) && 0 < count( $page ) ) :
$translate_page = get_post($page[0]->ID);
$page_permalink = get_permalink( $translate_page ) ;
@chuckreynolds
chuckreynolds / antispambot-wordpress-shortcode.php
Created April 26, 2017 22:43
Antispambot WordPress shortcode function
<?php
/**
* Hide email from Spam Bots using a shortcode.
* Anti-Spambot Email Shortcode, v1.1.1
* https://wordpress.org/plugins/antispambot
*
* @param array $atts Shortcode attributes. Not used.
* @param string $content The shortcode content. Should be an email address.
*
* @return string The obfuscated email address.
@vimes1984
vimes1984 / Woocommerce product variable dynamic stock control
Last active March 18, 2021 23:19
Update product quantities dynamically, using woocommerce. Basically this question http://wordpress.stackexchange.com/questions/72662/woocommerce-fixed-quantity-of-a-product. If a product variation needs to update the total stock quantity say you seel packs of nails or packets of cigars or ml of a general litre stock...
<?php
/**
* GQ
*
* @package gq
* @author vimes1984 <churchill.c.j@gmail.com>
* @license GPL-2.0+
* @link http://buildawebdoctor.com
* @copyright 2-7-2015 BAWD
*/
@fazlurr
fazlurr / functions.php
Created July 4, 2014 11:49
Create custom login page in wordpress, and hook in functions - http://www.paulund.co.uk/create-your-own-wordpress-login-page
<?php
// Restrict dashboard access to administrator only
add_action( 'admin_init', 'ru_restrict_admin', 1 );
function ru_restrict_admin()
{
if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) {
wp_redirect( site_url() );
}
}
@gavinhungry
gavinhungry / nginx-tls.conf
Last active March 11, 2024 14:51
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@chrisdigital
chrisdigital / Frontend user profile in WordPress
Created May 6, 2013 13:27
Setting up a editable user profile in WordPress on the frontend.
//How to edit a user profile on the front end?
//http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end
//Forcing nickname as display_name in custom edit profile template
//http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template
///////
<?php