Skip to content

Instantly share code, notes, and snippets.

@illucent
illucent / gist:9510044
Created March 12, 2014 16:06
wp code snippets
http://www.billerickson.net/code/
$ tar zxvf gnatcoll-gpl-2011-src.tgz
$ ./configure --prefix=/usr/gnat/ --disable-projects --disable-pygtk
$ PROCESSORS=4 make
$ make install
$ cd examples
$ make
$ cd gmp/
$ ./isprime
(try a few numbers)
$ cd
<?php
/* Example Usage:
* bt_add_image_size( 'product-screenshot', 300, 300, array( 'left', 'top' ) );
* bt_add_image_size( 'product-feature', 460, 345, array( 'center', 'top' ) );
*/
add_filter( 'intermediate_image_sizes_advanced', 'bt_intermediate_image_sizes_advanced' );
add_filter( 'wp_generate_attachment_metadata', 'bt_generate_attachment_metadata', 10, 2 );
/**
http://jimmac.musichall.cz/blog/2013-11-21-transcoding-with-gstreamer/
Transcoding image sequences (and cropping along the way)
#Sequence of JPEGs to h264:
gst-launch-1.0 qtmux name=mux ! filesink location=\"timelapse.mp4\" multifilesrc location=\"G%07d.JPG\" index=20376 caps=\"image/jpeg,framerate=\(fraction\)30/1\" ! jpegdec ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1440 ! videocrop top=180 left=0 right=0 bottom=180 ! videorate ! x264enc bitrate=10000 ! mux.
#Sequence of PNGs to h264:
gst-launch-1.0 qtmux name=mux ! filesink location=\"timelapse.mp4\" file:///`pwd`/snd/foo.flac ! decodebin ! audioconvert ! avenc_aac ! mux. multifilesrc location=\"composite/%04d.png\" index=1 caps=\"image/png,framerate=\(fraction\)24/1\" ! pngdec ! videoconvert ! videoscale ! videorate ! x264enc threads=12 ! mux.
#PNG to Ogg Theora:
<?php // Add an ID to identify this link.
$facetid = preg_replace('/\W+/','',strtolower(strip_tags($variables['text'])));
$variables['options']['attributes']['id'] = 'facet-' . $facetid; ?> - See more at: http://particle-in-a-box.com/blog-post/themeable-links-widget-facetapi#sthash.XmBaCYE7.dpuf
<?php
// http://fwpolice.com/tutorials/coding/basic-contact-form/
// Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
$website = ($_GET['website']) ?$_GET['website'] : $_POST['website'];
$message= ($_GET['message']) ?$_GET['message'] : $_POST['message'];
#!/usr/bin/env ruby
# coding: UTF-8
# ARGV[0] - string with text, need to be spoken
# ARGV[1] - filename for new wav file
require 'mechanize'
# retrieve web page with tts
a = Mechanize.new
@illucent
illucent / gist:9685077
Created March 21, 2014 12:23
wp admin settings
http://www.presscoders.com/2013/04/how-to-simplify-the-wordpress-admin-for-your-clients/
@illucent
illucent / gist:9697294
Created March 21, 2014 21:54
mce html
http://wordpress.stackexchange.com/questions/101850/tiny-mce-before-init-preventing-custom-shortcode-icon-appearing
<?php
function thsp_tiny_mce_settings( $tinyMCESettings ) {
return $tinyMCESettings;
/*
This is what $tinyMCESettings array looks like
$tinyMCESettings = Array (
[mode] => exact
[width] => 100%