Skip to content

Instantly share code, notes, and snippets.

View Rarst's full-sized avatar
Otherwise occupied.

Andrey Savchenko Rarst

Otherwise occupied.
View GitHub Profile
@Rarst
Rarst / class-opera-bookmarks-parser.php
Last active September 30, 2017 07:54
Parser for Opera's native bookmarks.adr format.
<?php
/**
* Parse Opera's bookmarks.adr file.
*/
class Opera_Bookmarks_Parser {
/** @var string path to bookmarks.adr */
public $adr;
@Rarst
Rarst / r-cache-scripts.php
Created February 20, 2013 19:22
Black magic, probably breaks something.
<?php
r_cache_scripts();
function r_cache_scripts() {
if ( is_admin() )
return;
global $wp_scripts;
@Rarst
Rarst / class-autoload-wp.php
Created February 27, 2013 17:47
Generic autoloader for classes named in WordPress coding style.
<?php
if ( ! class_exists( 'Autoload_WP' ) ) {
/**
* Generic autoloader for classes named in WordPress coding style.
*/
class Autoload_WP {
public $dir = __DIR__;
@Rarst
Rarst / composer.json
Last active December 18, 2024 08:20
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@Rarst
Rarst / CommentsFeed.php
Last active July 28, 2021 10:27
Build Gist comments feed for specific user, using GitHub API.
<?php
namespace Rarst\GitHub\Gist;
use GuzzleHttp\Client;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
/**
* Build Gist comments feed for specific user, using GitHub API.
@Rarst
Rarst / a-fresher-cache.php
Last active September 5, 2024 01:36
Additional items for A Fresher Cache WP plugin: APC, plugin/themes updates.
<?php
add_action( 'init', function () {
if ( ! function_exists( 'afc_add_item' ) || ! function_exists( 'apc_clear_cache' ) ) {
return;
}
afc_add_item( array(
'id' => 'apc',
@Rarst
Rarst / md-link.js
Created June 3, 2013 19:53
Bookmarklet for markdown link of current page
@Rarst
Rarst / readme.md
Last active December 24, 2015 22:09
Bolt on of whoops to WordPress, rough, proper plugin some time later
@Rarst
Rarst / mustachepot.php
Last active September 29, 2016 13:47
MustachePOT extends MakePOT in WordPress tools to additionally scan for localized strings in Mustache templates.
<?php
error_reporting( E_ALL ^ E_STRICT ); // le sigh
require __DIR__ . '/wordpress/tools/i18n/makepot.php';
/**
* Additionally scans for localized strings in Mustache templates.
*/
class MustachePOT extends MakePOT {
@Rarst
Rarst / griddle.php
Last active August 24, 2016 20:53
Responsive grid layout backgrounds for Bootstrap.
<?php
if ( isset( $_GET['grid'] ) ) {
add_action( 'wp_print_styles', function () { ?>
<style type="text/css">
@media (min-width: 768px) {
body {
background: url("http://griddle.it/720px-12-30px") repeat-y center top !important;
}