Skip to content

Instantly share code, notes, and snippets.

@n7studios
n7studios / post-to-social.php
Last active March 9, 2024 10:47
Determine Post Publish / Update via Classic Editor, Gutenberg and REST API
<?php
/**
* Example class implementation to perform actions, such as sending a Post
* to a third party API or service, when the Post is published or updated through:
* - Classic Editor
* - Gutenberg
* - REST API
*
* @package Post_To_Social
* @author Tim Carr
@joshbarrass
joshbarrass / cuemaker.py
Last active July 20, 2022 02:23
Python code to generate cue sheets (.cue files) from YouTube timestamps
import re
def pad_number(number,length=2,padding="0"):
str_number = str(number)
if len(str_number) < length:
str_number = padding+str_number
return str_number
def make_cue_tracks(inp,pattern="((\\d{1,2}):)?(\\d{1,2}):(\\d{1,2}) - (.*)",
hr=1,m=2,s=3,title=4,artist=None):
@SkyzohKey
SkyzohKey / screen-spoofer.user.js
Last active June 4, 2024 10:23
~ Spoof the reported window.screen as the most common one so that it can't be used to fingerprint browser.
// ==UserScript==
// @name Spoof screen resolution & color depth
// @namespace https://skyzohlabs.be
// @version 1.0.5
// @description Spoof the reported window.screen as the most common one so that it can't be used to fingerprint browser.
// @author SkyzohKey
// @include http://*
// @include https://*
// @run-at document-end
// @grant none
<?php
// Init
// -----------------------------------------------------------------------
define('DOING_AJAX', true);
define('SHORTINIT', true);
// WP Load
// -----------------------------------------------------------------------
require('wp-load.php');
@Sporif
Sporif / userChrome.css
Last active April 26, 2022 09:38
NOTE: Doesn't work with Firefox 72+. Add userChrome.js support to Firefox with just userChrome.css. A compact version of https://github.com/Sporif/firefox-quantum-userchromejs. Instead of loading userChrome.xml file it uses a data URI.
toolbarbutton#alltabs-button {
-moz-binding: url(data:text/plain;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8IS0tIENvcHlyaWdodCAoYykgMjAxNyBIYWdnYWkgTnVjaGkNCkF2YWlsYWJsZSBmb3IgdXNlIHVuZGVyIHRoZSBNSVQgTGljZW5zZToNCmh0dHBzOi8vb3BlbnNvdXJjZS5vcmcvbGljZW5zZXMvTUlUDQogLS0+DQoNCjwhLS0gUnVuIHVzZXJDaHJvbWUuanMvdXNlckNocm9tZS54dWwgYW5kIC51Yy5qcy8udWMueHVsLy5jc3MgZmlsZXMgIC0tPg0KPGJpbmRpbmdzIHhtbG5zPSJodHRwOi8vd3d3Lm1vemlsbGEub3JnL3hibCI+DQogICAgPGJpbmRpbmcgaWQ9ImpzIj4NCiAgICAgICAgPGltcGxlbWVudGF0aW9uPg0KICAgICAgICAgICAgPGNvbnN0cnVjdG9yPjwhW0NEQVRBWw0KICAgICAgICAgICAgICAgIGlmKHdpbmRvdy51c2VyQ2hyb21lSnNNb2QpIHJldHVybjsNCiAgICAgICAgICAgICAgICB3aW5kb3cudXNlckNocm9tZUpzTW9kID0gdHJ1ZTsNCg0KICAgICAgICAgICAgICAgIHZhciBjaHJvbWVGaWxlcyA9IEZpbGVVdGlscy5nZXREaXIoIlVDaHJtIiwgW10pLmRpcmVjdG9yeUVudHJpZXM7DQogICAgICAgICAgICAgICAgdmFyIHh1bEZpbGVzID0gW107DQogICAgICAgICAgICAgICAgdmFyIHNzcyA9IENjWydAbW96aWxsYS5vcmcvY29udGVudC9zdHlsZS1zaGVldC1zZXJ2aWNlOzEnXS5nZXRTZXJ2aWNlKENpLm5zSVN0eWxlU2hlZXRTZXJ2aWNlKTsNCg0KICAgICAgICAgIC
@zgordon
zgordon / registerblock-custom-icon-gutenberg.js
Last active January 2, 2022 19:56
Example for how to create use a custom SVG icon for a block in Gutenberg
// Import __ from i18n internationalization library
const { __ } = wp.i18n;
// Import registerBlockType() from block building libary
const { registerBlockType } = wp.blocks;
// Import the element creator function (React abstraction layer)
const el = wp.element.createElement;
/**
* Example of a custom SVG path taken from fontastic
*/
@davrous
davrous / browserextensionpolyfill.js
Created November 24, 2016 17:41
Tip to make your code compatible with all browsers
window.browser = (function () {
return window.msBrowser ||
window.browser ||
window.chrome;
})();
@tzmartin
tzmartin / embedded-file-viewer.md
Last active July 1, 2024 01:57
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@gorhill
gorhill / gist:ef1b62d606473c68d524
Last active February 16, 2023 21:17
Disqus comments widget: on-demand
! Title: Disqus click-to-load
# Copy-paste the static filters below into your "My filters" pane in the
# dashboard.
# Purpose is to load Disqus comments on demand only, so that no connection
# to `disqus.com` occurs by default when you land on a site which uses
# Disqus comments widget.
# Not connecting to Disqus by default is a good thing for such a
# ubiquitous server as `disqus.com`, which can be used to build a