Skip to content

Instantly share code, notes, and snippets.

John Cyrill Corsanes jcchikikomori

Block or report user

Report or block jcchikikomori

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
@jcchikikomori
jcchikikomori / wordpress-tinymce.js
Created Nov 18, 2019 — forked from RadGH/wordpress-tinymce.js
Get/Set content of a TinyMCE visual or text editor with JavaScript
View wordpress-tinymce.js
/*
Based on: http://wordpress.stackexchange.com/questions/42652/#answer-42729
These functions provide a simple way to interact with TinyMCE (wp_editor) visual editor.
This is the same thing that WordPress does, but a tad more intuitive.
Additionally, this works for any editor - not just the "content" editor.
Usage:
@jcchikikomori
jcchikikomori / script.js
Created Nov 14, 2019 — forked from ihorvorotnov/script.js
Using wp_is_mobile() in WordPress to detect mobile users (phones and tablets)
View script.js
jQuery( document ).ready( function($) {
if ( $( "body" ).hasClass("wp-is-mobile"){
/* Do javascript for mobile */
}
else{
/* Do javascript for non-mobile */
}
});
@jcchikikomori
jcchikikomori / cors_support.conf
Created Oct 25, 2019 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
View cors_support.conf
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support.conf;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
View gist:bc7093ca03e4277a7e1483d8ce983b41
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@jcchikikomori
jcchikikomori / cdn-jquery.php
Created Oct 16, 2019 — forked from Shelob9/cdn-jquery.php
Replace WordPress' jQuery with CDN jQuery of the right version
View cdn-jquery.php
add_action( 'init', function(){
if ( ! is_admin()) {
if( is_ssl() ){
$protocol = 'https';
}else {
$protocol = 'http';
}
/** @var WP_Scripts $wp_scripts */
global $wp_scripts;
@jcchikikomori
jcchikikomori / .htninja
Created Oct 10, 2019
NinjaFirewall config for Bedrock
View .htninja
<?php
/*
+=====================================================================+
| NinjaFirewall optional configuration file |
| |
| See: https://nintechnet.com/ninjafirewall/wp-edition/help/?htninja |
| |
+=====================================================================+
| |
| BEDROCK SUPPORT |
@jcchikikomori
jcchikikomori / bedrock-project.conf
Last active Oct 10, 2019
LINUX VALET HOSTS for BEDROCK - because valet link command was a pussy
View bedrock-project.conf
server {
listen 80;
server_name bedrock-mohawk.localhost;
charset utf-8;
root /home/jccorsanes/www/bedrock-project/web;
index index.php index.html;
#access_log /usr/local/var/log/nginx/access.log;
#error_log /usr/local/var/log/nginx/error.log;
@jcchikikomori
jcchikikomori / NGINX-CORS+CSP.conf
Created Oct 8, 2019 — forked from adrianorsouza/NGINX-CORS+CSP.conf
Nginx CORS and CSP configuration for wildcard origin domains
View NGINX-CORS+CSP.conf
server {
...
add_header Content-Security-Policy "default-src 'none'";
add_header X-Content-Security-Policy "default-src 'none'";
add_header X-WebKit-CSP "default-src 'none'";
add_header "Access-Control-Allow-Headers" "X-Requested-With";
if ( $http_origin ~* (https?://(.+\.)?(domain1|domain2|domain3)\.(?:me|co|com)$) ) {
@jcchikikomori
jcchikikomori / custom-ajax-spotify.php
Created Sep 23, 2019 — forked from ivanlebanov/custom-ajax-spotify.php
Spotify API integration with WordPress
View custom-ajax-spotify.php
<?php
function ajax_enquiry_init(){
wp_register_script('jquery', 'https://code.jquery.com/jquery-1.11.2.min.js' );
wp_enqueue_script('jquery');
wp_register_script('main', get_template_directory_uri() . '/js/main.js', array('jquery') );
wp_enqueue_script('main');
wp_localize_script( 'main', 'ajax_auth_object', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
You can’t perform that action at this time.