Skip to content

Instantly share code, notes, and snippets.

View cfinke's full-sized avatar

Christopher Finke cfinke

View GitHub Profile
diff --git a/modules/widget-visibility/widget-conditions.php b/modules/widget-visibility/widget-conditions.php
index bcb32dc..6aedfec 100644
--- a/modules/widget-visibility/widget-conditions.php
+++ b/modules/widget-visibility/widget-conditions.php
@@ -17,6 +17,26 @@ class Jetpack_Widget_Conditions {
add_action( 'widget_display_callback', array( __CLASS__, 'filter_widget' ) );
add_action( 'sidebars_widgets', array( __CLASS__, 'sidebars_widgets' ) );
}
+
+ /**
@cfinke
cfinke / chrome_locales_in_firefox.js
Created December 10, 2010 18:05
A method for using Google Chrome-style locales in Firefox extensions.
var MY_EXTENSION_STRINGS = {
"strings" : {},
get : function (key, substitutions) {
if (key in this.strings) {
var bundle = this.strings[key];
var message = this.strings[key].message;
if ("placeholders" in bundle) {
After I finished <a href="http://www.chrisfinke.com/2015/09/03/i-built-a-table/">our kitchen table</a>, I started on two benches: one for each long side of the table. At the last minute, my wife and I decided (a.k.a., my wife decided) to include some storage areas in the benches too.
Just like with the table, I started with a design in OpenSCAD:
<a href="http://www.chrisfinke.com/files/2015/09/Screen-Shot-2015-09-25-at-10.55.27-AM.png" rel="attachment wp-att-13987"><img class="alignnone size-large wp-image-13987" src="http://www.chrisfinke.com/files/2015/09/Screen-Shot-2015-09-25-at-10.55.27-AM-1024x681.png" alt="Screen Shot 2015-09-25 at 10.55.27 AM" width="696" height="463" /></a>
(And just like with the table, <a href="https://github.com/cfinke/Farmhouse-Table/blob/master/Bench.scad">the source file is on GitHub</a>.) Both the benches and the table are actually generated by the same code, so they literally are miniature versions of the table.
I bought some 15" pine legs from Home Depot, but I wanted an
@cfinke
cfinke / html-posts.php
Created October 16, 2012 14:44
Write all of the posts in a WordPress blog as HTML files
<?php
/**
* Drop this file in wp-content/mu-plugins/ (create if it doesn't exist),
* create a writable directory on your server to store the HTML, then call
* http://www.yourblog.com/?html-output-dir=/path/to/dir/you/created.
*/
function write_html_posts() {
remove_filter( 'the_content', 'wptexturize' );
@cfinke
cfinke / flickr-sideload.php
Created October 30, 2014 14:23
Retroactively sideload images into WordPress from Flickr. Used for a once-off. Not lots of error checking. Stick in mu-plugins and then load wp-admin/?do_flickr_sideload
<?php
/**
* Retroactively sideload images referenced from Flickr.
*/
$flickr_sideload_media_id = null;
function flickr_sideload_get_media_id( $media_id ) {
global $flickr_sideload_media_id;
@cfinke
cfinke / Avatar Animation
Last active December 16, 2015 09:38
Code snippet for generating CSS animation code to rotate seven elements around a center point.
<?php
$steps = array();
$steps[1] = 'top: 0px; left: 0px;';
$steps[2] = 'top: 0px; left: 85px;';
$steps[3] = 'top: 0px; left: 170px;';
$steps[4] = 'top: 170px; left: 170px;';
$steps[5] = 'top: 170px; left: 85px;';
$steps[6] = 'top: 170px; left: 0px;';
$steps[7] = 'top: 85px; left: 0px;';

Keybase proof

I hereby claim:

  • I am cfinke on github.
  • I am cfinke (https://keybase.io/cfinke) on keybase.
  • I have a public key whose fingerprint is B819 213F 069D ECBE 7EA2 39C1 253D 2774 6910 0F2E

To claim this, I am signing this object:

@cfinke
cfinke / gist:959868
Created May 6, 2011 21:54
Method for using Google Chrome JSON locale files in Firefox extensions.
var MY_EXTENSION_STRINGS = {
"strings" : {},
get : function (key, substitutions) {
if (key in this.strings) {
var bundle = this.strings[key];
var message = this.strings[key].message;
if ("placeholders" in bundle) {