Skip to content

Instantly share code, notes, and snippets.

@r-a-y
r-a-y / cuemaker.py
Last active April 6, 2024 16:28 — forked from joshbarrass/cuemaker.py
Python code to generate cue sheets (.cue files) from YouTube timestamps
"""
A script for automatically generating CUE files from a list of timestamps and titles, like
those commonly seen in YouTube descriptions.
Usage:
python cuemaker.py --output="Filename without extension" "timestamps.txt" "Album name" "Artist name"
"timestamps.txt" should be a text file containing a list of timestamps and titles like:
00:00 Track 1
@r-a-y
r-a-y / _readme.md
Last active February 12, 2024 09:03
Using Git for Windows (PortableGit) with a portable HOME directory

Prologue

I develop on Windows (yeah, I hear your jeers, linux users!), so to use Git, I use Git for Windows

However, I use Git For Windows (portable version) so I can keep my dev environment centrally located. This is so I can reuse this environment simply by copying my msysgit directory to a USB drive.

Installation

@r-a-y
r-a-y / readme.md
Last active September 28, 2023 05:36
Using node.js / npm with PortableGit

Prologue

I develop on Windows (yeah, I hear your jeers, linux users!), so to use Git, I use Git for Windows.

However, I use Git for Windows (portable version) so I can keep my dev environment centrally located. This is so I can reuse this environment simply by copying my PortableGit directory to a USB drive.

Using a portable set up means you can't use those handy automatic installers to your dev environment. This makes installing other scripts like node.js a little bit more difficult because you have to manually do-it-yourself. No biggie! This is what this guide is for!

Installation

@r-a-y
r-a-y / warnings.php
Last active August 17, 2023 11:46
Suppress warnings created by certain plugins and themes in WordPress.
/**
* Suppress errors generated by specified WordPress plugins.
*
* Put this in /wp-content/mu-plugins/
*
* @param string $errno The error number.
* @param string $errstr The error message.
* @param string $errfile Path to the file that caused the error.
* @param int $errline Line number of the error.
* @return bool True to suppress error reporting; false to use default error handler.
@r-a-y
r-a-y / bp-footer-debug.php
Last active November 19, 2022 00:34
A BuddyPress debug plugin that outputs some useful BuddyPress global variables in the footer.
@r-a-y
r-a-y / bp-activity-comments-stream.php
Created April 16, 2014 22:02
Force activity loops in BuddyPress to show activity comments as separate entries all the time.
<?php
/*
Plugin Name: BuddyPress - Show Individual Activity Comments Separately
Description: Force activity loops to show activity comments as separate entries.
Version: 0.1
Author: r-a-y
Author URI: http://profiles.wordpress.org/r-a-y
License: GPLv2 or later
*/
@r-a-y
r-a-y / gist:5578432
Last active July 23, 2020 06:55
Disable BuddyPress' registration and use WP's instead. Paste this in /wp-content/plugins/bp-custom.php.
/**
* Disables BuddyPress' registration process and fallsback to WordPress' one.
*/
function my_disable_bp_registration() {
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' );
remove_action( 'bp_screens', 'bp_core_screen_signup' );
}
add_action( 'bp_loaded', 'my_disable_bp_registration' );
@r-a-y
r-a-y / bp-page-title.php
Created June 13, 2016 05:53
Use page title as set in admin area on BP directory pages.
/**
* Use page title for BP directory pages.
*/
function my_set_bp_page_title() {
// Check to see if current reset post is a BP directory; if not, bail.
if ( false == in_array( $GLOBALS['post']->ID, bp_core_get_directory_page_ids() ) ) {
return;
}
// Use WP page title for the_title().
@r-a-y
r-a-y / wpadd
Last active January 21, 2020 00:19
Bash function to quickly install / update a WordPress plugin / theme and commit the addition in Git. Shove this in your .bashrc.
# Bash function to quickly install / update a plugin / theme and commit the addition.
#
# Function should be run from the root WP directory.
#
# Requires:
# wp-cli - http://wp-cli.org; should be used as 'wp'
# git - duh'doy! :)
#
# Usage:
# wpadd -slug "slug-of-item" -new "1.0.0"
@r-a-y
r-a-y / shortcode.php
Created February 22, 2012 21:01
Check if a shortcode exists in WordPress
<?php
if ( ! function_exists( 'shortcode_exists' ) ) :
/**
* Check if a shortcode is registered in WordPress.
*
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
*/
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;