- Create
.octoprint/plugins/filetab
and.octoprint/plugins/filetab/templates
- Copy
__init__.py
to.octoprint/plugins/filetab
- Copy
filetab_tab.jinja2
to.octoprint/plugins/filetab/templates
- Modify
.octoprint/plugins/config.yaml
to includefiles
in thedisabled
values forsidebar
(see example) - Optional: Adjust the
order
fortab
if you want the "Files" tab to be placed somewhere else than after the regular tab components (see example) - Restart OctoPrint, verify in the log that it discovered the plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( !function_exists( "is_subscriber" ) ){ | |
function is_subscriber() { | |
// Test if role is subscriber | |
$cu = wp_get_current_user(); | |
if (!empty($cu->roles) && is_array($cu->roles)) { | |
if(in_array('subscriber', $cu->roles)) { | |
return true; | |
} | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Redirect WordPress Logout to Home Page - Anonymous Function | |
add_action('wp_logout',create_function('','wp_redirect(home_url());exit();')); | |
// Redirect WordPress Logout to Home Page - Full Function | |
function logout_redirect_home(){ | |
wp_safe_redirect(home_url()); | |
exit; | |
} | |
add_action('wp_logout', 'logout_redirect_home'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Replace WordPress Dashboard | |
* Description: Replaces the default WordPress dashboard with a custom one. | |
* Author: Micah Wood | |
* Author URI: http://micahwood.me | |
* Version: 0.1 | |
* License: GPL3 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Luhn Class is an implementation of the Luhn algorithm that checks validity of a credit card number. | |
* | |
* @author <a href="http://www.chriswareham.demon.co.uk/software/Luhn.java">Chris Wareham</a> | |
* @version Checks whether a string of digits is a valid credit card number according to the Luhn algorithm. 1. Starting with the second to last digit and | |
* moving left, double the value of all the alternating digits. For any digits that thus become 10 or more, add their digits together. For example, | |
* 1111 becomes 2121, while 8763 becomes 7733 (from (1+6)7(1+2)3). 2. Add all these digits together. For example, 1111 becomes 2121, then 2+1+2+1 is | |
* 6; while 8763 becomes 7733, then 7+7+3+3 is 20. 3. If the total ends in 0 (put another way, if the total modulus 10 is 0), then the number is valid | |
* according to the Luhn formula, else it is not valid. So, 1111 is not valid (as shown above, it comes out to 6), while 8763 is valid (as shown | |
* above, it comes ou |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array( | |
'AL' => 'Alabama', | |
'AK' => 'Alaska', | |
'AZ' => 'Arizona', | |
'AR' => 'Arkansas', | |
'CA' => 'California', | |
'CO' => 'Colorado', | |
'CT' => 'Connecticut', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
''' | |
A response to: http://stackoverflow.com/questions/19831757/how-to-create-macro-in-sublime-text-3-with-saveas-and-close-file-command | |
Save the current file with encoding UTF8, then close. | |
To trigger the command with 'Command Option Shift 8', | |
add the following to your Sublime Text > Preferences > Keybindings - User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helps with IE debugging. | |
jQuery.extend({ | |
getScript: function(url, callback) { | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); | |
var done = false; // Handle Script loading | |
script.src = url; | |
script.onload = script.onreadystatechange = function() { // Attach handlers for all browsers | |
if ( !done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) { |
jQuery's $.getScript
function is a quick and easy way to include external JavaScript files into a website. However, its default implimentation will not cache the script file for the client.
The following information describes how you can itilize cached versions of $.getScript
- Include jquery, if it's not already.