Skip to content

Instantly share code, notes, and snippets.

View florianbrinkmann's full-sized avatar

Florian Brinkmann florianbrinkmann

View GitHub Profile
@westonruter
westonruter / phpcs.xml
Last active December 8, 2017 12:01
WPSE 286375: A dynamic dropdown-pages control. https://wordpress.stackexchange.com/q/286375/8521
<?xml version="1.0"?>
<ruleset name="WPSE 286375 Plugin">
<rule ref="WordPress-Core" />
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" value="wpse-286375,default" />
</properties>
</rule>
<rule ref="WordPress-Docs" />
@odan
odan / xampp_php7_xdebug.md
Last active October 19, 2024 04:15
Installing Xdebug for XAMPP
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active November 13, 2024 15:50
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@Vestride
Vestride / encoding-video.md
Last active November 15, 2024 17:57
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@pagelab
pagelab / functions.php
Created April 10, 2014 17:46
Changing WordPress Theme Customizer default options
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_control( 'background_color' )->section = 'background_image';
$wp_customize->get_section( 'background_image' )->title = 'Background Settings';
$wp_customize->get_section( 'title_tagline' )->title = 'Site Title / Logo';
$wp_customize->get_section( 'static_front_page' )->title = 'Home Page Settings';
$wp_customize->get_section( 'static_front_page' )->priority = 29;
@hissy
hissy / gist:7352933
Created November 7, 2013 11:07
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter