Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile
@franz-josef-kaiser
franz-josef-kaiser / http_ssl_fix.php
Last active October 11, 2015 02:10
WordPress HTTP API cURL SSL Fix for Poodle and Friends
<?php
/**
* Plugin Name: Fix SSL Versions
* Description: Remove SSL v1-3 from cURL Requests. PHP v5.5.19+/5.6.3+ only
* Author: Franz Josef Kaiser <[email protected]>
* Author URl: http://unserkaiser.com
* License: MIT
*/
/**
@franz-josef-kaiser
franz-josef-kaiser / nano-shorts.md
Last active August 2, 2025 10:30
nano keyboard shortcuts

^ = Ctrl key M = Alt key

^G      (F1)            Display this help text
^X      (F2)            Close the current file buffer / Exit from nano
^O      (F3)            Write the current file to disk
^J      (F4)            Justify the current paragraph

^R      (F5)            Insert another file into the current one
@franz-josef-kaiser
franz-josef-kaiser / attachment_role_limit.php
Last active August 29, 2015 14:16
WordPress Plugin: Limit the display of attachments (in the admin screens) to the ones uploaded by the current user
<?php
/**
* Plugin Name: Attachment Role limit
* Plugin URI: https://gist.github.com/franz-josef-kaiser/0688bfb7fda30e815ef8
* Description: Limit the display of attachments (in the admin screens) to the ones uploaded by the current user.
* Version: 2015.02.24
* Author: Franz Josef Kaiser <[email protected]>
* Author URI: http://unserkaiser.com
* License: MIT
* License URI: https://tldrlegal.com/license/mit-license
@franz-josef-kaiser
franz-josef-kaiser / col-s.less
Created January 21, 2015 10:29
Twitter Bootstrap: The missing Column for the phone & tablet - with @media queries - Fixes the gap between XS and MD columns with a new `col-s-[1-12]` column that spans between 480px and 768px
/* In your variables.less after the boostrap/less/variables.less were included */
// New width/colums: `col-s-[1-12]`
// Fixes the gap between XS and MD
@screen-s-min: 480px;
@screen-s-max: (@screen-sm-min - 1);
@screen-xs-max: (@screen-s-min - 1);
/* After the bootstrap/less/grid.less was included */
@franz-josef-kaiser
franz-josef-kaiser / composer.json
Created January 15, 2015 19:20
Load wordpress.org SVN repository l18n tools via Composer
{
"require-dev" : {
"wporg/i18n" : "~4.1"
},
"repositories": [
{
"type" : "package",
"package" : {
"name" : "wporg/i18n",
"version" : "4.1",
@franz-josef-kaiser
franz-josef-kaiser / remote_fetch.php
Last active August 29, 2015 14:13
Fetch remote file, get all Links using PHPs \DOMDocument
<?php
// @author Jack (Original Author) incl. error handling
// @link http://codegolf.stackexchange.com/a/44340/11940
// modify state
$libxml_previous_state = libxml_use_internal_errors( true );
$source = 'http://stroustrup.com/C++.html';
$dom = new \DOMDocument;
// Dump error suppression not needed here as LibXML errors are handled above
@franz-josef-kaiser
franz-josef-kaiser / example.tmpl
Created January 9, 2015 09:28
Underscore template example to add it to PHPStorms Recognized File Types
<span id="<%= ids.span_id %>"
style="background-color: <%= colors.color1 %>;"
onMouseOver="this.style.color='<%= colors.color2 %>'"></span>
<div class="some-class" id="<% typeof( foo.bar ) === 'undefined' ? ids.hidden : '' %>"></div>
<a class="anchor" href="<%= target.link %>" target="_blank">
<?php
/**
* Plugin Name: (WCM) Backbone/Underscore template loader
* Description: Loads Underscore (or other) templates using the WP Dependency API
*/
/**
* @author Franz Josef Kaiser http://unserkaiser.com/
* @link http://chat.stackexchange.com/transcript/message/19439060#19439060
*/
@franz-josef-kaiser
franz-josef-kaiser / git-diff-single-file.sh
Last active March 12, 2016 20:48
Useful Git CLI commands
#!/bin/bash
# Show changes within a single file - 1 commit back - in unified (no blank lines) format
git diff -U0 master~1:file.ext file.ext
# -----
# Example:
diff --git a/composer.json b/composer.json
@franz-josef-kaiser
franz-josef-kaiser / meta_data.php
Last active August 29, 2015 14:10
Example Meta Value inside a MetaBox, saved & sanitized.
<?php /* Plugin Name: Sanitize Meta Test */
#RETURN;
/**
* Register meta: Hide from "Custom Fields" panel
* __return_true : show - __return_false : hide
* The idea is to give the user access to the meta data
* when the plugin already has been turned off or removed
* but hide it as long as your plugin is activated.