Skip to content

Instantly share code, notes, and snippets.


Sergey Mochalov proweb

View GitHub Profile
ivandoric / wl-api.php
Last active Nov 27, 2021
WordPress Rest API Custom Endpoints Video Tutorials Notes - Check out the videos: and
View wl-api.php
* Plugin Name: Custom API
* Plugin URI:
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI:
mattclements / function.php
Last active Nov 25, 2021
Wordpress Disable Comments (add to function.php)
View function.php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
View minimal-analytics-snippet.js
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
isaacs /
Last active Nov 22, 2021
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
ericclemmons /
Last active Nov 22, 2021
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

 <summary>Summary Goes Here</summary>
tomazzaman /
Last active Nov 3, 2021
Gulp workflow for WordPress theme development

Gulp workflow for WordPress theme development


In order for Livereload to work, you need a Firefox or Chrome extension as Gulp doesn't inset it automatically. Alternatively, you can also manually put the livereload script in footer.php, just make sure to insert it only on development environment:

<script>document.write('<script src="http://' + ( || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
Last active Oct 25, 2021 — forked from iambibhas/scopes.txt
Sublime Text 2/3: Snippet scopes

Here is a list of scopes to use in Sublime Text 2/3 snippets -

ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
nternetinspired / gist:7482445
Last active Jul 3, 2021
Load Disqus comments only on demand if you give a shit about page weight and your visitors. Even with no comments, i.e. an empty comment form, calling Disqus will load an extra 226Kb. If your page has comments this can be far higher. This Gist accompanies my blog post:
View gist:7482445
// Requires jQuery of course.
$(document).ready(function() {
$('.show-comments').on('click', function(){
var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username.
// ajax request to load the disqus javascript
type: "GET",
url: "http://" + disqus_shortname + "",
dataType: "script",
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."