Skip to content

Instantly share code, notes, and snippets.

View jpjuliao's full-sized avatar

Juan Pablo Juliao jpjuliao

View GitHub Profile
@jpjuliao
jpjuliao / express-url-calculator.ts
Last active February 9, 2023 14:46
ExpressJS calculator via URL path
/**
* This script serves a simple calculator app which get the input from the URL path.
*
* URL Format: http://locahost/:{port}/{number1}{math operator(+, -, * or /)}/{number2}
* Example: http://localhost:3333/23+40
*/
const express = require('express')
const app = express()
const port = 3333
@jpjuliao
jpjuliao / html-to-image.js
Created April 9, 2020 20:56
HTML element to image via JS
// jQuery.getScript('https://github.com/tsayen/dom-to-image/blob/master/dist/dom-to-image.min.js');
// jQuery.getScript('https://raw.githubusercontent.com/eligrey/FileSaver.js/master/dist/FileSaver.min.js');
(function($){
function download(elem) {
domtoimage.toBlob(
elem,
{
height: 343.47,
@jpjuliao
jpjuliao / .gitignore
Last active December 7, 2019 19:06 — forked from pixeline/.gitignore
Default Wordpress .gitignore file
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@jpjuliao
jpjuliao / OpenExternalLinksInNewWindow.js
Created September 23, 2019 02:35
Open external links in new window, except mailto and tel.
function OpenExternalLinksInNewWindow() {
$('a').each(function() {
if (
this.href.startsWith('tel:')
|| this.href.startsWith('mailto:')
) {
return;
}
var a = new RegExp('/' + window.location.host + '/');
if(!a.test(this.href)) {
<?php
/**
* Plugin name: PHP Execute External Programs
* Description: Run terminal commands. Usage: add querystring 'cmd' on any admin url to load the console
* Author: Juan Pablo Juliao
* Version: 1.0
*/
if (!defined('ABSPATH')) exit;
<?php
if ( !defined('ABSPATH') ) exit();
/**
* Plugin name: Post View Tracker
* Plugin URI: http://jpjuliao.com/
* Description: Track and order by post views in woocommerce.
* Version: 1.0
* Author: Juan Pablo Juliao
* Author URI: https://jpjuliao.com