Skip to content

Instantly share code, notes, and snippets.

@rohmann
rohmann / hide-siteurl-option.php
Created September 7, 2013 22:39
Some CSS to hide the Site URL and Home URL from the Wordpress settings page. http://git.io/fFVxOA
<?php
add_action('admin_head', 'custom_admin_css');
function custom_admin_css() { ?>
<style>
label[for=siteurl], input[name=siteurl], label[for=home], input[name=home], input[name=home] + p.description {
display: none;
}
</style>
<?php
<?php
class View {
public static function __callStatic($name,$parameters) {
try {
//Get template name from method call
$fname = TEMPLATES_DIR . implode('/', explode("_",$name) ).'.php';
@rohmann
rohmann / escalate.php
Created October 25, 2013 18:53
Tool to esaclate an admin to super admin in WordPress
<?php
/*
Plugin Name: Escalate to Super Admin
Plugin URI: https://gist.github.com/rohmann/7159907
Description: Tool to convert normal admin to super admin.
Place in mu-plugins folder. Then visit /wp-admin with a normal admin account. Next, go to the network dashboard to test it. Finally, delete this plugin to prevent abuse
Author: Alexander Rohmann
Author URI: https://gist.github.com/rohmann
Version: 1.0
*/
@rohmann
rohmann / mp-promo-tagging.php
Last active December 29, 2015 14:59
When "on sale" is toggled, a "promo" tag will automatically be added/removed from the product. http://git.io/pOvGzg
<?php
function auto_tag_on_sale( $meta_id, $post_id, $meta_key) {
if ('mp_is_sale' != $meta_key){
return;
}
$meta = get_post_custom($post_id);
$on_sale = false;
@rohmann
rohmann / anchor.js
Created April 3, 2014 22:07
Target an a tag normally used for anchor navigation. Provide an offset element, and it can do an animated scroll and compensate for fixed headers
jQuery(function($){
$('section a').click(function(e){
e.preventDefault();
$('html,body').animate({
scrollTop: $('#' + $(this).attr('href').split("#").slice(-1)[0] ).offset().top - $('header').height()
},700 ,'swing');
});
});
@rohmann
rohmann / wp-debug.php
Last active August 29, 2015 14:01
Debugging for live WordPress environments.
define('WP_DEBUG', true);
if (WP_DEBUG) {
/**
* Log errors to wp-content/debug.log
* Don't forget to delete this when you're finished,
* as it may be publicly accessible.
*/
define('WP_DEBUG_LOG', true);
@rohmann
rohmann / goodbye-skype.sh
Last active March 18, 2017 20:25
Cleanup cmd+tab and the dock by launching apps in the background. You can still open their main windows with Alfred/Spotlight.
# Go away
defaults write "$(mdfind kMDItemCFBundleIdentifier = 'com.skype.skype')/Contents/Info.plist" "LSUIElement" -string "1" && killall Skype
# Come back
defaults write "$(mdfind kMDItemCFBundleIdentifier = 'com.skype.skype')/Contents/Info.plist" "LSUIElement" -string "0" && killall Skype
# If you get any requests to use the keychain, they should go away the next time you restart your mac. You may be asked to sign into Skype again.
/**
* Add the cs-row-flip class to a row, and the column direction will be reversed.
*/
.x-container.marginless-columns.cs-row-flip {
direction: rtl;
}
.x-container.marginless-columns.cs-row-flip > .x-column {
direction: ltr;
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@rohmann
rohmann / app-view.js
Created September 14, 2016 18:50
Add class to Ember Application (after 2.7.0)
// instance-initializers/app-view.js
// With an instance initializer, we can register a component for Ember to use at the top level.
// Not ideal, but it works in the meantime until routable components drop.
import Ember from 'ember';
const AppView = Ember.Component.extend({
classNames: ['my-app'],
});