Skip to content

Instantly share code, notes, and snippets.

@CoHyper
CoHyper / script.js
Last active July 18, 2024 19:44
HTML SELECT sortieren
var orgeinheitenSortieren = {
init: function () {
orgeinheitenSortieren.start();
},
start: function () {
document.addEventListener('DOMContentLoaded', () => {
// Holt das Element für die Auswahl
var elementId = orgeinheitenSortieren.getElement();
@CoHyper
CoHyper / index.html
Last active July 6, 2024 19:47
CSS Border Style
<!DOCTYPE html>
<html>
<head>
<title>Border-Style</title>
<style>
.border {
border: 2px solid black;
border-radius: 10px;
padding: 5px;
}
@CoHyper
CoHyper / index.php
Last active June 10, 2024 17:46
PHP Google Charts Class
<?php
class Charts {
private string $_domId = "";
private string[] $_errorMessages = [];
const _x_AJAX_API = "https://www.gstatic.com/charts/loader.js";
const _x_DEFAULT_CHART = 'PieChart';
const _x_DEFAULT_ANIMATION_DURATION = 1000;
@CoHyper
CoHyper / index.php
Last active June 7, 2024 15:48
PHP Dummy
<?php
/**
*
*/
function aktualisiereStatusWennDatumGroesser() {
// update, vergleichen, insert
$sql = "UPDATE table1 AS t1
JOIN table2 AS t2
ON t1.guid = t2.guid
@CoHyper
CoHyper / index.php
Last active June 6, 2024 23:25
PHP 2d array_diff()
<?php
/**
* 2-Dimensonales Array miteinander vergleichen.
* Vergleicht Werte von Arrays und gibt ein Array zurück, das alle Werte aus
* dem ersten Array enthält, die in den anderen Arrays nicht vorhanden sind.
*
* @param array $array1
* @param array $array2
* @return array - Differenz zwischen beiden Arrays
@CoHyper
CoHyper / index.php
Last active June 10, 2024 16:22
PHP date 1 Year
<?php
/**
* @example
* $now = '2024-04-17';
* $maximum = '2025-04-17'; // one year from $now
* $dates = getDates('2024-04-18', null, 1); // Get dates one year from 2024-04-18 daily till $maximum
* $dates = getDates('2024-07-17', null, 2); // Get dates one year from 2024-07-17 weekly till $maximum
* $dates = getDates('2024-02-16', '2025-02-16', 3); // Get dates from now to 2025-02-16 monthly
*/
@CoHyper
CoHyper / index.php
Last active May 30, 2024 07:31
PHP Regex disable < and >
<?php
/**
* Klasse zur sicheren Verarbeitung von HTML-Text.
*
* @php >= v8.0
*
* @todo optionale parameter setzen
*/
class HTMLSanitizer
@CoHyper
CoHyper / index.html
Last active May 21, 2024 19:09
CSS HTML Custom input-checkbox color
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Benutzerdefinierte Checkbox</title>
<style>
.custom-checkbox {
position: relative;
display: inline-block;
@CoHyper
CoHyper / index.php
Last active May 2, 2024 22:55
PHP Microsoft Graph API
<?php
// Konfiguration
$clientId = 'DEINE_CLIENT_ID';
$clientSecret = 'DEIN_CLIENT_GEHEIMNIS';
$tenantId = 'DEINE_MIETER_ID';
$resource = 'https://graph.microsoft.com/';
$tokenEndpoint = 'https://login.microsoftonline.com/' . $tenantId . '/oauth2/token';
// Zugriffstoken abrufen
@CoHyper
CoHyper / index.php
Last active April 29, 2024 22:40
PHP Excel PhpSpreadsheet
<?php
require 'vendor/autoload.php'; // Pfade entsprechend anpassen
use PhpOffice\PhpSpreadsheet\IOFactory;
class ExcelReader
{
private $excelFile;
private $worksheets = [];