Skip to content

Instantly share code, notes, and snippets.

@bremercreative
bremercreative / voxel - password protected user entries
Last active February 19, 2024 16:45
voxel - password protected user entries
/////////// Step 1 ///////////
- for your desired post type add the two following custom fields
1. switcher (field key: switcher-pw)
2. text (field key: text-passwort)
@lukaskleinschmidt
lukaskleinschmidt / LICENSE.md
Last active April 14, 2024 14:26
Kirby 3 Synced Structure

MIT License

Copyright (c) 2023 Lukas Kleinschmidt

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 copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT

@adamkiss
adamkiss / index.php
Last active January 2, 2023 15:19
Kirby: easy Simple Snippets plugin
<?php
use Kirby\Cms\App;
App::plugin('adamkiss/simple-snippets', []);
if (! function_exists('s')) {
/**
* Short, auto-return snippet call with support for auto-merging certain parameters
*
* @param string $snippetName
@HDDen
HDDen / OutputmodMinify.php
Last active January 18, 2024 15:41 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP class to Minify HTML, CSS and JavaScript
<?php
/**
* Class OutputmodMinify
*
* include_once 'OutputmodMinify.php';
* $html = \OutputmodMinify::minify($html);
*/
/**
* -----------------------------------------------------------------------------------------
@stracker-phil
stracker-phil / test_json_performance.php
Last active October 4, 2022 23:57
Performance comparison for various PHP functions that test, if a string is valid JSON.
<?php
// https://stackoverflow.com/a/6041773/313501#answer-6041773
function test1( $value ) {
if ( ! is_scalar( $value ) ) {
return null;
}
json_decode( $value );
return ( json_last_error() == JSON_ERROR_NONE );
@hivivo
hivivo / install-caprover.sh
Last active February 8, 2024 18:52
Install CapRover on a brand new Ubuntu 22.04 standard server
#!/bin/bash
# Ubuntu 22.04
# Please also allow `80, 443, 3000` ports in the VM network rules if apply
# run as sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root or use sudo"
exit
fi
@bradtraversy
bradtraversy / stack.js
Created May 29, 2020 14:35
Stack data structure
class Stack {
constructor() {
this.items = []
this.count = 0
}
// Add element to top of stack
push(element) {
this.items[this.count] = element
console.log(`${element} added to ${this.count}`)
@Witawat
Witawat / php-html-css-js-minifier.php
Created April 12, 2020 13:55 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@Mrxchaoz
Mrxchaoz / Function.Array-Group-By.php
Created January 21, 2020 02:47 — forked from mcaskill/Function.Array-Group-By.php
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.
<?php
//remove palavras que podem permitir o sql injection
function anti_injection($sql){
$sql = preg_replace(sql_regcase("/(http|www|wget|from|select|insert|delete|where|.dat|.txt|.gif|drop table|show tables| or |#|\*|--|\\\\)/"),"",$sql);
$sql = trim($sql);
$sql = strip_tags($sql);
$sql = addslashes($sql);
return $sql;
}