- You need to have the latest version of Node. Preferably, you're using 9.8.0, but the latest LTS should work as well.
- You should have
npx
installed usingnpm install -g npx
. - Install the React Developer Tools.
This file contains hidden or 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 | |
/** | |
* @param WP_Query|null $wp_query | |
* @param bool $echo | |
* @param array $params | |
* | |
* @return string|null | |
* | |
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507 | |
* |
This file contains hidden or 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
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; // importing xmlhttprequest package because node doesn't support it out of the box | |
const superHeroes = ['Batman', 'Superman', 'WonderWoman', 'Flash', 'Cyborg', 'Aquaman', 'Green Lantern', 'Martian Manhunter']; // an array of request params | |
const completedFetchingData = () => { // function to be called when all ajax requests complete. | |
console.log('Just completed fetching the data'); | |
} | |
const failedFetchingData = () => { // function to be called when data fetching fails | |
console.log('Failed to fetch the data'); | |
} | |
const ajaxRequestWithPromise = (param) => { |
- Download ngrok binary
- https://ngrok.com/download
- unzip to /opt/ngrok
- Create /etc/systemd/system/ngrok.service
- Create /opt/ngrok/ngrok.yml
This file contains hidden or 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
#!/usr/bin/env bash | |
if [ "$(uname)" = "Darwin" ]; then | |
jq=/usr/local/bin/jq | |
wget=/usr/local/bin/wget | |
image_folder_path="/Users/$USER/Documents/Images/Bing/" | |
mkdir -p $image_folder_path |
This file contains hidden or 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
function sanitize_chinese_user( $username, $raw_username, $strict ) { | |
if ( $username != $raw_username ) { | |
$username = $raw_username; | |
} | |
$username = strip_tags( $username ); | |
// Kill Chinese characters | |
$username = preg_replace( '|[^a-z0-9 _.\-@一-龥]|ui', '', $username ); | |
// Consolidate contiguous whitespace |
This file contains hidden or 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
// Create a new object for custom validation of a custom field. | |
var nameSpaceController = Marionette.Object.extend( { | |
initialize: function() { | |
this.listenTo( nfRadio.channel( 'form' ), 'render:view', this.doCustomStuff ); | |
}, | |
doCustomStuff: function( view ) { | |
var formModel = view.model; // formModel will be a Backbone model with all of our form data. | |
var formID = formModel.get( 'id' ); // We can use .get( 'setting' ) get get any of our form settings. |
This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12
- Installing Homebrew is effortless, open Terminal and enter :
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :
This file contains hidden or 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 //* Mind this opening PHP tag | |
// Remove the logout link in comment form | |
add_filter( 'comment_form_logged_in', '__return_empty_string' ); |