Skip to content

Instantly share code, notes, and snippets.

@cfstras
cfstras / 0 YtLight.md
Last active January 30, 2024 17:27
Lightweight YouTube Oneboxer for Discourse.

Note (2024): This was relevant in 2014, when the YouTube OneBoxer integrated with Discourse was not exactly behaving how I liked it, so I made this one.
It probably doesn't work anymore.

YtLight

Replace those nasty YouTube iframes with static images for ultimate loading time in threads with lots of videos

When clicked, they get replaced by the actual iframe.

@markoheijnen
markoheijnen / gist:2399864
Created April 16, 2012 16:40
Change Post to News
<?php
add_action( 'init', array( &$this, 'change_post_object_label' ), 0 );
add_action( 'admin_menu', array( &$this, 'change_post_menu_label' ), 0 );
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages') );
function change_post_menu_label() {
global $menu;
global $submenu;
if( isset( $menu[5], $submenu['edit.php'] ) ) {
@jmdodd
jmdodd / gist:1708947
Created January 31, 2012 05:05
Display tweets from Ozh' Tweet Archiver using oEmbed
<?php
// You will need to replace the in_category( 'twit' ) conditional with one that fits your own setup.
if ( ! function_exists( 'ucc_twitter_oembed_the_content' ) ) {
function ucc_twitter_oembed_the_content( $content ) {
global $post;
$screen_name = 'YOUR_SCREEN_NAME_HERE';
if ( in_category( 'twit' ) ) {
$tweet_url = "http://twitter.com/#!/{$screen_name}/status/" . get_post_meta( $post->ID, 'ozh_ta_id', true );
$content = "\n[embed]{$tweet_url}[/embed]\n";
@jmdodd
jmdodd / gist:1458820
Created December 11, 2011 06:19
Set custom post type and taxonomy terms with Ozh' Tweet Archiver
<?php
if ( ! function_exists( 'ucc_ozh_ta_insert_tweets_post' ) ) {
function ucc_ozh_ta_insert_tweets_post( $data ) {
// Replace values of [tax_input][category] and [post_type] with appropriate values.
$data['tax_input']['category'] = '1,2';
$data['post_type'] = 'tweet';
return $data;
} }
add_filter( 'ozh_ta_insert_tweets_post' , 'ucc_ozh_ta_insert_tweets_post' );
@jmdodd
jmdodd / gist:1318760
Created October 27, 2011 04:08
Filter tweet timestamp in Ozh' Tweet Archiver to match blog's specified GMT offset
<?php
if ( ! function_exists( 'ucc_ozh_ta_insert_tweets_post_filter' ) ) {
function ucc_ozh_ta_insert_tweets_post_filter( $postarr ) {
$offset = get_option( 'gmt_offset' ) * 3600;
$date = date( 'Y-m-d H:i:s', strtotime( $postarr['post_date'] . ' UTC' ) + $offset );
$postarr['post_date'] = $date;
return $postarr;
} }