Skip to content

Instantly share code, notes, and snippets.

petrosmm / cli.ts
Last active Jun 10, 2022
route builder sample for directus; used when item in questions are linked but self-referencing
View cli.ts
#!/usr/bin/env node
import fetch from "node-fetch";
import _ from "lodash";
import Enumerable from "node-enumerable";
interface RootResult {
data: DataResult[];
View gist:72398d84c5e6cababf935e51b58604fe

I have been searching for a way to properly inline images into emails for Sendy ( I have only found one way to do it. This method involves using src='cid:imagecidnamejpg' as an attribute on the <img /> tags that you intend to inline. Example below if I attach a file named imagecidname.jpg then my cid value in the src tag should be imagecidnamejpg. As another example: if I use img01.png, it will strip anything except a-z, 0-9 chars and you will be left img01png as your corresponding cid value.

Replace $mail->AddAttachment($attachment); in the /scheduled.php and /includes/create/send-now.php with

if (strpos($attachment, '.jpg') !== false || strpos($attachment, '.png') !== false) { $cid = preg_replace('/[^a-zA-Z0-9]+/', '', basename($attachment)); $mail->AddEmbeddedImage($attachment, $cid, basename($attachment)); } else {

petrosmm / logparser.sql
Last active Dec 20, 2017
IIS Errors SQL script using Log Parser with Site Id and local DateTime showing only results from current day
View logparser.sql
SELECT EXTRACT_SUFFIX(EXTRACT_PATH(LogFilename), 0, '\W3SVC') as Site, TO_LOCALTIME(TO_TIMESTAMP(date, time)) AS [datetime], [LogFilename], [LogRow], [c-ip], [cs-username], [s-sitename], [s-computername], [s-ip], [s-port], [cs-method], [cs-uri-stem], [cs-uri-query], [sc-status], [sc-substatus], [sc-win32-status], [sc-bytes], [cs-bytes], [time-taken], [cs-version], [cs-host], [cs(User-Agent)], [cs(Cookie)], [cs(Referer)], [s-event], [s-process-type], [s-user-time], [s-kernel-time], [s-page-faults], [s-total-procs], [s-active-procs], [s-stopped-procs]
/* remove columns: [date], [time], */
[sc-status] NOT BETWEEN 200 AND 399
ORDER BY datetime desc
View openemr_psych_form.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- I created this form for a Doctor's office that I contract with. Generated by hand. -->
<!-- Please note that the following variables '{{ }}' at the top of the code need to be implemented. -->
<table type="form">{{table}}_{{date}}</table>
<RealName>{{RealName}} {{date}}</RealName>
<style cells_per_row="5">layout</style>
<acl table="patients">med</acl>
petrosmm / MidpointRounding.AwayFromZero.js
Last active Sep 13, 2021
A function to assist in MidpointRounding.AwayFromZero on the client side
View MidpointRounding.AwayFromZero.js
function RoundAwayFromZero(startValue, digits) {
var decimalValue = 0;
digits = digits || 0;
startValue *= parseFloat(Math.pow(10, (digits + 1)));
decimalValue = parseInt(Math.floor(startValue)) - (Math.floor(startValue / 10) * 10);
startValue = Math.floor(startValue / 10);
if (decimalValue >= 5) {
startValue += 1;
startValue /= parseFloat(Math.pow(10, (digits)));