Skip to content

Instantly share code, notes, and snippets.

Nate Wright NateWr

Block or report user

Report or block NateWr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NateWr
NateWr / comment-blacklist-for-rtb.php
Last active Aug 6, 2019
Check new bookings for blacklisted words in comments for Restaurant Reservations
View comment-blacklist-for-rtb.php
<?php
/**
* Plugin Name: Comment Blacklist for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Check if a booking includes blacklisted words from Settings > Discussion > Comment Blacklist before accepting it.
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@NateWr
NateWr / remove-publishing-mode.php
Last active May 7, 2019
Remove the publishingMode setting from the access form for everyone except the site admin.
View remove-publishing-mode.php
<?php
/**
* Remove the publishingMode setting from the access form for
* everyone except the site admin
*/
HookRegistry::register('Form::config::before', function ($hookName, $form) {
if (!defined('FORM_ACCESS') || $form->id !== FORM_ACCESS) {
return;
}
if (/* user is not an admin */) {
@NateWr
NateWr / block-publishing-mode.php
Created May 7, 2019
Block requests to change the publishingMode setting from anyone except the site admin.
View block-publishing-mode.php
<?php
/**
* Refuse requests to change the publishingMode setting from anyone
* except the site admin.
*/
HookRegistry::register('Context::validate', function($hookName, $args) {
$errors &= $args[0];
$props &=$args[2];
if (/* user is not an admin */) {
View js2_test.md

What is the value result in these code snippets

// 1
var writerAge = 10
var result = writerAge + 5
20
// 2
@NateWr
NateWr / GenerateMetrics.php
Last active May 6, 2019
A CLI tool to generate fake metrics data. Place under `/tools/GenerateMetrics.php` and run `php tools/GenerateMetrics.php`.
View GenerateMetrics.php
<?php
/**
* @file tools/GenerateMetricsTool.php
*
* Copyright (c) 2014-2019 Simon Fraser University
* Copyright (c) 2003-2019 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class GenerateMetricsTool
@NateWr
NateWr / date-time-template-tags-for-rtb.php
Created Apr 10, 2019
Add separate template tags for the date and time of the booking request.
View date-time-template-tags-for-rtb.php
<?php
/**
* Plugin Name: Date and Time Template Tags for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Add separate template tags for the date and time of the booking request.
* Version: 0.0.1
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@NateWr
NateWr / email-templates-for-rtb-logo-size.php
Created Mar 5, 2019
Use a custom logo size for the email templates addon for Restaurant Reservations.
View email-templates-for-rtb-logo-size.php
<?php
/**
* Plugin Name: Custom Logo Size for Email Templates for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Use a custom logo size for the email templates addon for Restaurant Reservations.
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@NateWr
NateWr / RemoveIncompleteFromActiveListPlugin.inc.php
Last active Feb 27, 2019
Remove incomplete submissions from the active submissions list in OJS/OMP.
View RemoveIncompleteFromActiveListPlugin.inc.php
<?php
class RemoveIncompleteFromActiveListPlugin extends GenericPlugin {
/**
* Initialize the plugin
*/
public function init() {
HookRegistry::register ('TemplateManager::display', array($this, 'modifyTemplateData'));
}
/**
@NateWr
NateWr / new-shortcode-name-for-rtb.php
Created Jan 21, 2019
Duplicate the [booking-form] shortcode with a [rtb-booking-form] shortcode.
View new-shortcode-name-for-rtb.php
<?php
/**
* Plugin Name: New Shortcode Name for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Duplicate the [booking-form] shortcode with a [rtb-booking-form] shortcode.
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@NateWr
NateWr / show-shortcodes-for-fdm.php
Created Dec 20, 2018
Show the menu and menu item shortcodes in the admin lists.
View show-shortcodes-for-fdm.php
<?php
/**
* Plugin Name: Show Shortcodes for Food and Drink Menu
* Plugin URI: http://themeofthecrop.com
* Description: Show the menu and menu item shortcodes in the admin lists.
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
You can’t perform that action at this time.