Skip to content

Instantly share code, notes, and snippets.

View bardware's full-sized avatar

Bernhard Döbler bardware

View GitHub Profile
<?php
// the function reads the comment added after the function is called using a backtrace and uses them as arguments
function add(): float
{
$trace = debug_backtrace();
$file = $trace[0]['file'];
$line = $trace[0]['line'];
$content = file($file);
@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)
@rajibchy
rajibchy / ArrayStack.cs
Last active February 17, 2026 23:24
Pop, Shift and Push off array in C# equivalent of `Javascript` `Array`
// Copyright (c) 2022 Safe Online World Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
@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:
@DejayRezme
DejayRezme / Av1SvtEnc.ps1
Created January 22, 2022 19:51
Script to encode a bunch of files with SvtAv1EncApp and ffmpeg from command line
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
[string] $inputPath,
[int] $sp = 7,
[int] $crf = 28,
[int] $fg = 0,
[switch] $af,
[switch] $wi
)
if ($af) {$audioOptions = "-af channelmap=channel_layout=5.1"}
@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 = {