Skip to content

Instantly share code, notes, and snippets.

@kongondo
kongondo / windows_font_installer.py
Created March 3, 2024 22:34 — forked from lpsandaruwan/windows_font_installer.py
Install a font file in Windows - Python3
""" Python 3 Windows font installer
Script must be run with the privileges in order to access Windows fonts directory. System reboot is not necessary.
This will install the font and will inform programs that a new font has been added.
Python3 Windows font installer is a free python script: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@kongondo
kongondo / index.php
Created February 15, 2024 10:26 — forked from vielhuber/index.php
get next letter in alphabet #php
<?php
$letter = 'A';
echo ++$letter; // outputs 'B'
echo chr(ord($letter) + 3); // outputs 'E'
?>
@kongondo
kongondo / example-recursive-function1a.php
Last active August 30, 2023 08:45
Menu Builder getMenuItems() Examples
<?php
/**
* Builds a nested list (menu items) of a single menu.
*
* A recursive function to display nested list of menu items.
*
* @access private
* @param Int $parent ID of menu item.
* @param Array $menu Object of menu items to display.
@kongondo
kongondo / UpdateProcessWireFrontendContentUsingHtmxDemo.js
Last active August 11, 2023 11:47
Using htmx to Refresh ProcessWire Frontend Content
const UpdateProcessWireFrontendContentUsingHtmxDemo = {
initHTMXXRequestedWithXMLHttpRequest: function () {
document.body.addEventListener("htmx:configRequest", (event) => {
// @note: ADD THIS!!! if not using hx-include='token input'
// const csrf_token = UpdateProcessWireFrontendContentUsingHtmxDemo.getCSRFToken()
// event.detail.headers[csrf_token.name] = csrf_token.value
// add XMLHttpRequest to header to work with $config->ajax
event.detail.headers["X-Requested-With"] = "XMLHttpRequest"
})
},
@kongondo
kongondo / preventAdditionalMouseEvent.html
Created April 15, 2023 12:02 — forked from toruta39/preventAdditionalMouseEvent.html
Prevent mouseout/mouseover event triggered when moving onto/from a child element
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Prevent additional mouse event</title>
</head>
<body>
<div id="ele" style="width: 300px; height: 300px; background-color: #0FF;">
This is the parent element.
<div style="width: 200px; height: 200px; background-color: #FFF;">
@kongondo
kongondo / form-process.php
Created June 7, 2013 09:14 — forked from somatonic/form-process.php
ProcessWire example front-end form with file upload and fields
<?php
// ------------------------------ FORM Processing ---------------------------------------
$errors = null;
$success = false;
// helper function to format form errors
function showError($e){
return "<p class='error'>$e</p>";
@kongondo
kongondo / remote-file-copy.php
Created January 14, 2016 13:01
Remote file copying with progress reporting in PHP.
<?php
/*
* Remote File Copy PHP Script 2.0.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
@kongondo
kongondo / salesTax.md
Created September 27, 2021 05:08 — forked from lakshmantgld/salesTax.md
Free Sales Tax API based on Postal code by Avalara

Sales Tax API

There are many companies providing sales tax API. Out of all the companies, Avalara offers free API service for sales Tax. This gist is all about setting up avalara API and querying it.

The Free-To-Use API by avalara has some restrictions. Usage of this API is subject to rate limits. Users who exceed the rate limit will receive HTTP response code 429 - Too Many Requests. The requirement for this API is to create an avalara free trail account. You can create a free account using this link create free account.

Once you have filled the form from above link, you will get an e-mail containing temporary credentials to login the avalara account. The e-mail will look something like this:

Avalara e-mail

@kongondo
kongondo / salesTax.md
Created September 27, 2021 05:08 — forked from lakshmantgld/salesTax.md
Free Sales Tax API based on Postal code by Avalara

Sales Tax API

There are many companies providing sales tax API. Out of all the companies, Avalara offers free API service for sales Tax. This gist is all about setting up avalara API and querying it.

The Free-To-Use API by avalara has some restrictions. Usage of this API is subject to rate limits. Users who exceed the rate limit will receive HTTP response code 429 - Too Many Requests. The requirement for this API is to create an avalara free trail account. You can create a free account using this link create free account.

Once you have filled the form from above link, you will get an e-mail containing temporary credentials to login the avalara account. The e-mail will look something like this:

Avalara e-mail

@kongondo
kongondo / renderPosts
Last active June 21, 2021 02:53
ProcessWire. MarkupBlog's renderPosts() as an independent reusable and editable function outside Blog
function renderPosts($posts, $small = false, Array $options = null) {
$blogConfigs = wire('modules')->getModuleConfigData('ProcessBlog');
//intialise some properties from ProcessBlog config
$commentsUse = $blogConfigs['commentsUse'];
$authorsPage = wire('pages')->get($blogConfigs['blog-authors']);
$settingsPage = wire('pages')->get($blogConfigs['blog-settings']);