Skip to content

Instantly share code, notes, and snippets.

View w33zy's full-sized avatar

Kemory Grubb w33zy

  • 21:48 (UTC -04:00)
View GitHub Profile
<?php
/**
* The Template for displaying content of post format standard
*
* @author tokoo
* @version 2.0
* @file wp-content/themes/pustaka-child/template-parts/content.php
*/
<?php
namespace App\Services;
use Ratchet\Http\HttpServer;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
class RatchetServer implements MessageComponentInterface
jQuery(document).ready(function() {
jQuery("#the-empty-div").click(function(){
jQuery.ajax({
type: 'POST',
url: my_ajax_data.ajax_url,
data: {
action: 'my_ajax_action_callback',
security: my_ajax_data.security_nonce,
first_name: 'John', // Get this however
last_name: 'Smith', // Get this however
<?php
function generate_json_ld() {
if ( ! is_single() ) {
return null;
}
$data = [];
@w33zy
w33zy / ID.js
Created August 22, 2019 12:19
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
<div id="currently-reading">
<currently-reading></currently-reading>
</div>
<template id="reading-template">
<div id="rcno-currently-reading">
<div class="rcno-currently-reading-widget-fe">
<div class="book-cover" title="89% completed">
<div class="progress-bar-container">
<img src="/src/book-cover.jpg" alt="book-cover" />
@w33zy
w33zy / php-block.js
Created August 6, 2018 02:05 — forked from pento/php-block.js
Converting a shortcode to a block
// 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.
<?php
/*
Plugin Name: Import demo
Plugin URI: http://royduineveld.nl
Description: A demo import for my blog
Version: 1.0
Author: Roy Duineveld
Author URI: http://royduineveld.nl
*/
@w33zy
w33zy / rtl-testing.php
Created March 6, 2018 19:29
Testing how WordPress handles the parsing of URL params in RTL languages
<?php
/**
* Plugin Name: RTL Testing
* Plugin URI: https://wzymedia.com
* Description: Testing an issue with RTL languages and URL params.
* Author: w33zy
* Author URI: https://wzymedia.com
* Text Domain: rtl-testing
* Domain Path: /languages
* Version: 0.1.0
@w33zy
w33zy / nativeShare.js
Created January 22, 2018 01:03
Native Sharing in Chrome for Android
function nativeSharing() {
if (navigator.share === undefined) {
console.log('Error: Unsupported feature: navigator.share');
return;
}
var title = document.title;
var text = 'Shared from Example.com';
var url = window.location.href;