Skip to content

Instantly share code, notes, and snippets.

@tzmartin
tzmartin / m3u8-to-mp4.md
Last active November 14, 2024 23:44
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@joshuadavidnelson
joshuadavidnelson / gravity-form-cmb2-options.php
Last active August 5, 2018 17:28
A function to return an array of gravity forms for a CMB2 select field.
<?php
/**
* Get an array of gravity forms.
*
* @since 1.0.0
*
* @return void
*/
function jdn_gf_options() {
$form_array = array();
@mgratch
mgratch / RCP_login_redirect.php
Created May 8, 2015 22:39
Automatically redirect users to where they came from upon logging in and out. Warning this does cause a problem when logging out from a restricted content page.
<?php
function mg_rcp_hijack_login_url() {
global $rcp_options;
if( isset( $rcp_options['login_redirect'] ) ) {
$login_url = get_the_permalink( $rcp_options['login_redirect'] );
}
return $login_url;
}
@pjrvs
pjrvs / newslettercookie.html
Last active November 7, 2017 09:33
a jquery cookie that shows a signup form for people that aren't signed up and an alternate message for people that came from the list or signed up.
<!DOCTYPE html>
<html>
<head>
<title>jQuery Cookie + MailChimp</title>
<meta charset="utf-8">
</head>
<body>
<form action="XXX" method="post" class="signup">

Configure

xdebug.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
@pippinsplugins
pippinsplugins / gist:11402562
Last active December 15, 2021 17:07
Custom user fields for Restrict Content Pro
<?php
/*
Plugin Name: Restrict Content Pro - Custom User Fields
Description: Illustrates how to add custom user fields to the Restrict Content Pro registration form that can also be edited by the site admins
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active September 15, 2024 20:33
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

<?php
function be_custom_loop() {
$loop = new WP_Query( $args );
if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
$classes = 0 == $loop->current_post || 0 == $loop->current_post % 2 ? 'one-half first' : 'one-half';
echo '<div class="' . $classes . '">' . get_the_title() . '</div>';
endwhile; endif; wp_reset_postdata();
}
@thomasgriffin
thomasgriffin / gist:8012662
Last active December 31, 2015 16:19
REMOVE ALL THE METABOXES FROM ALL THE THINGS. WARNING: THIS THING IS VERY AGGRESSIVE.
<?php
add_action( 'add_meta_boxes', 'tgm_remove_all_the_metaboxes', 100 );
/**
* Removes all metaboxes except the ones I WANT ON MY POST TYPE. RAGE.
*
* This assumes a specific post type. In my case, it is 'envira'.
* This function is very aggressive and removes every single metabox minus
* the needed submitdiv metabox (which allows you to publish something) and
* the metaboxes that I register with my plugin.
*