Skip to content

Instantly share code, notes, and snippets.

Avatar

Yakir Sitbon KingYes

View GitHub Profile
@bjornjohansen
bjornjohansen / run-wp-cron.sh
Last active Feb 23, 2022
Run all due cron events for WordPress with WP-CLI. Works with both single sites and multisite networks.
View run-wp-cron.sh
#!/bin/bash
# Copyright © 2015 Bjørn Johansen
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
WP_PATH="/path/to/wp"
# Check if WP-CLI is available
if ! hash wp 2>/dev/null; then
@Rarst
Rarst / WordPress.xml
Last active Aug 5, 2021
WordPress Live Templates for PhpStorm
View WordPress.xml
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
@KingYes
KingYes / lame-vbr-id3tags.py
Created Nov 26, 2013
Encode audio files (VBR Profile) and preserve id3 tags used with `lame` program.
View lame-vbr-id3tags.py
#!/bin/python
# -*- coding: utf-8 -*-
"""
Encode audio files (VBR Profile) and preserve id3 tags
used with `lame` program.
@Author: Yakir Sitbon <http://www.yakirs.net/>
@Version: 1.0
"""
import os
@KingYes
KingYes / omer-count.php
Created Apr 9, 2013
Very PHP Simple method for counting of the Omer.
View omer-count.php
<?php
/**
* Very Simple method for Omer count.
*
* @return bool|int Omer count or false if out Omer range date.
*
* @author Yakir Sitbon (http://www.yakirs.net/)
*/
function yakir_get_omer_count() {
// Get now jd date.
@Rarst
Rarst / backtrace-error-handler.php
Created Oct 4, 2012
Error handler with WordPress backtrace in message.
View backtrace-error-handler.php
<?php
set_error_handler( 'backtrace_error_handler', error_reporting() );
function backtrace_error_handler( $errno, $errstr, $errfile, $errline, $errcontext ) {
// handle @
if( 0 === error_reporting() )
return false;
@Rarst
Rarst / deprecated.md
Last active Aug 9, 2022
WordPress coding standards configuration for PhpStorm
View deprecated.md

Now Native

PhpStorm now bundles WordPress coding style natively, starting from version 8.

  1. Go to Project Settings > Code Style > PHP.
  2. Select Set From... (top right of window) > Predefined Style > WordPress.

No longer need to muck with this import! :)