Skip to content

Instantly share code, notes, and snippets.

View bardware's full-sized avatar

Bernhard Döbler bardware

View GitHub Profile
@MrPunyapal
MrPunyapal / StringMagic.php
Created November 28, 2023 15:48
Exploring PHP 8.3: Alphanumeric String Magic ✨
<?php
// PHP 8.3 introduces exciting new functions for
// incrementing and decrementing alphanumeric strings!
// Let's dive into some examples to see how they work.
// str_increment — Increment an alphanumeric string
echo str_increment("a") . PHP_EOL; // b
@JamoCA
JamoCA / queryReturnRow-udf.cfm
Last active February 27, 2023 21:27
queryReturnRow UDF to convert a ColdFusion struct or array from a query row. Options to drop/replace NULL values. CF2016+
<cfscript>
/* 2023-02-27 queryReturnRow() by SunStar Media https://www.sunstarmedia.com/
Requires CF2016+ or Lucee
Inspired by https://cflib.org/udf/queryGetRow & https://docs.lucee.org/reference/functions/queryrowdata.html
GIST: https://gist.github.com/JamoCA/f18c868fcb2d8f23b797f9c7b2ee93e9
TWEET: https://twitter.com/gamesover/status/1630291299097260032
- Renamed function to something unique because queryGetRow() is a BIF (as of CF11)
- Updated to retain column order by default (using an ordered struct)
- Option to set key case (original/lower/upper)
@JamoCA
JamoCA / mergeQbSqlBindingsUDF.cfm
Last active December 30, 2022 20:23
mergeQbSqlBindings - ColdFusion/CFML UDF to be used with QB parameterized SQL string & binding array to generate reusable SQL
<cfscript>
/* 20221222 mergeQbSqlBindings UDF
by James Moberg / SunStar Media.
Tested w/MSSQL. To be used with QB parameterized SQL string & binding array to generate reusable SQL.
NOTE: Using Query Builder (QB) does not required ColdBox or CommandBox.
GIST: https://gist.github.com/JamoCA/bb681afd2eb1a0d6d380f3b714ccc138
TWEET: https://twitter.com/gamesover/status/1606008360976781312
GITHUB: https://github.com/coldbox-modules/qb
DOCS: https://qb.ortusbooks.com/query-builder/building-queries/parameters-and-bindings
USAGE:
@Mistobaan
Mistobaan / README.md
Last active February 19, 2023 17:21
How to fix the AMAG Installation on MacOS Catalina

I Purchased this mini keyboard to extend my editor with combinations of keys that I will never remember. Sadly installing the App was problematic as it does not work right away.

  1. The App is written in Adobe air (!). Download and install their library
  2. Install and run this command to overcome Catalina problems (Steve we miss you) (from this thread)[https://community.adobe.com/t5/air/adobe-air-error-message-macosx-catalina/td-p/10683302?page=1]:
sudo xattr -r -d com.apple.quarantine /Library/Frameworks/Adobe\ AIR.framework
  1. Downloaded the online software from Koolertron as of today (2020 June 20) is this link
// Unblock everyone on Twitter: Go to https://twitter.com/settings/blocked and paste the below in DevTools
// Yes this is super ugly and hacky don’t @ me
function click_all_unblock_buttons() { document.querySelectorAll('button.blocked-text').forEach(btn => btn.click()); }
function unblock(min_num_accounts) {
var checkNumber, autoScroll, curScrollPos, prevScrollPos, checkScroll, done;
done = false;
curScrollPos = prevScrollPos = window.scrollY;
checkScroll = setInterval(() => {
@marclove
marclove / .eslintrc
Created March 22, 2019 18:32
ESLint + Prettier + VSCode Configuration
{
"plugins": ["prettier"],
"extends": [
"plugin:prettier/recommended",
"plugin:jest/recommended"
],
"rules": {
// only rules that don't conflict with the rules declared in .prettierrc
}
// other eslint stuff
function calcAvg( numeric sold=0, numeric sales=0 ){
if( sales == 0 ){
return 0;
}
else{
return sold/sales;
}
}
data = {
@JamoCA
JamoCA / JUnidecode-ColdFusion-Demo.cfm
Last active September 21, 2023 13:34
JUnidecode ColdFusion Demo - Convert Unicode strings to somewhat reasonable ASCII7-only strings then strip diacritics and convert strings.
<cfprocessingdirective pageEncoding="utf-8">
<cfsetting enablecfoutputonly="Yes">
<!---
BLOG: https://dev.to/gamesover/convert-unicode-strings-to-ascii-with-coldfusion-junidecode-lhf
--->
<cfscript>
function JUnidecode(inputString){
var JUnidecodeLib = "";
var response = "";
@bdw429s
bdw429s / task.cfc
Created January 17, 2019 19:09
CommandBox Task Runner to download packages from RiaForge
/**
* Scrape all the binaries from RiaForge
*/
component {
property name="progressableDownloader" inject="ProgressableDownloader";
property name="progressBar" inject="ProgressBar";
function run() {
directoryCreate( resolvePath( 'downloads' ), true, true );
var projects = deserializeJSON( fileRead( 'http://riaforge.org/index.cfm?event=json.projects' ) );
@Panman82
Panman82 / jwt.cfc
Last active September 16, 2021 15:14
ColdFusion component which has functions to work with JSON Web Tokens.
component
displayName = "JSON Web Token"
hint = "Utility library to work with JSON Web Tokens."
{
// Supported algorithms
variables.algorithms = {
"HS256" = "HmacSHA256",
"HS384" = "HmacSHA384",