Skip to content

Instantly share code, notes, and snippets.

View Cauen's full-sized avatar
🎯
Focusing

Cauê Nolasco Cauen

🎯
Focusing
View GitHub Profile
@Cauen
Cauen / gist:eab04bf191d0980f18f87cf865c71741
Created May 29, 2020 20:42
Docker Swarm + Portainer + Traefik (Global Redirection & Subdomain & Auth to view Dashboard) + 2 backends
version: '3'
services:
traefik:
image: traefik:v2.0.0
command:
- --api.insecure=false # set to 'false' on production
- --api.dashboard=true # see https://docs.traefik.io/v2.0/operations/dashboard/#secure-mode for how to secure the dashboard
- --api.debug=true # enable additional endpoints for debugging and profiling
- --log.level=DEBUG # debug while we get it working, for more levels/info see https://docs.traefik.io/observability/logs/
@Cauen
Cauen / docker-swarm-traefik-subdomain-forcehttps.yml
Last active May 16, 2020 16:12
Docker Swarm + Traefik (Global Redirection & Subdomain & Auth to view Dashboard) + 2 backends
# Is needed to add A records to the address of the network
# Cname with * wildcard would be good
version: '3'
services:
traefik:
image: traefik:v2.0.0
command:
- --api.insecure=false # set to 'false' on production
@Cauen
Cauen / ajax_wp_plugin_options_page_unique_option_dynamic_fields_css.php
Created September 1, 2019 15:16
Ajax Options Page - Unique DB Option - CSS - Dynamic Fields
<?php
add_action('wp_ajax_save_i9_analytics_options', 'save_i9_analytics_options');
function save_i9_analytics_options()
{
var_dump($_POST);
if (!empty($_POST)) {
$i9_analytics_data = $_POST;
update_option('i9_analytics_integration_data', json_encode($i9_analytics_data));
@Cauen
Cauen / ajax_wp_plugin_options_page_unique_option.php
Last active September 1, 2019 00:10
Ajax Options Page - Unique DB Option
<?php
add_action('wp_ajax_save_i9_analytics_options', 'save_i9_analytics_options');
function save_i9_analytics_options()
{
if (!empty($_POST)) {
$i9_analytics_data = $_POST["data"];
update_option('i9_analytics_integration_data', json_encode($i9_analytics_data));
echo "OK";
wp_die();
@Cauen
Cauen / ajax_and_no_ajax_wp_plugin_options_page.php
Last active August 31, 2019 23:37
Ajax and no Ajax WP Options Page - Multiple DB Options
<?php
add_action('wp_ajax_save_i9_analytics_options', 'save_i9_analytics_options');
add_action('wp_ajax_nopriv_save_i9_analytics_options', 'save_i9_analytics_options');
function save_i9_analytics_options()
{
if (!empty($_POST)) {
$i9_heap_id = $_POST["i9_heap_id"];
$i9_mixpanel_id = $_POST['i9_mixpanel_id'];
$i9_amplitude_id = $_POST['i9_amplitude_id'];