This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function reflectUserFunction($userFunction) : ReflectionFunctionAbstract { | |
| if (is_string($userFunction)) { | |
| return new \ReflectionFunction($userFunction); | |
| } elseif (is_array($userFunction)) { | |
| return new ReflectionMethod($userFunction[0], $userFunction[1]); | |
| } | |
| trigger_error("Invalid user function", E_USER_ERROR); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function rf(Closure $f) { | |
| return new class($f) { | |
| private $f; | |
| public function __construct(Closure $f) | |
| { | |
| $this->f = $f; | |
| } | |
| public function __invoke() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function console() : Closure { | |
| $prompt = function(string $line) : Closure { | |
| $genericDefault = function(string $default = null) { | |
| return function(string $answer) use ($default) { | |
| if (empty($answer)) { | |
| return $default; | |
| } else { | |
| return $answer; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @param $bytes | |
| * @param int $decimals | |
| * @return string | |
| */ | |
| function human_filesize($bytes, $decimals = 2) { | |
| $sz = ['B','K','M','G','T','P']; | |
| $factor = min(count($sz), floor((strlen($bytes) - 1) / 3)); | |
| return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $sz[$factor]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package PROG4_WK3b; | |
| import javafx.application.Application; | |
| import javafx.event.EventHandler; | |
| import javafx.stage.Stage; | |
| import javafx.scene.Scene; | |
| import javafx.scene.input.MouseEvent; | |
| import javafx.scene.layout.BorderPane; | |
| import javafx.scene.layout.GridPane; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package PROG4_WK4b; | |
| import javafx.application.Application; | |
| import javafx.concurrent.Task; | |
| import javafx.scene.Scene; | |
| import javafx.scene.control.ProgressBar; | |
| import javafx.scene.layout.BorderPane; | |
| import javafx.stage.Stage; | |
| public class Main extends Application { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c4820dc0c242e7456a1e31ca466c815829bc85235eed13c708f20d961d1fec7ecc039aaa4ade427cf46352702ef3147c1be546fc46a3e9aa7d4e690ae178dd18 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| /usr/bin/find /var/backups/mysql/* -mtime +7 -exec rm {} \; | |
| for DB in $(mysql -e 'show databases' -s --skip-column-names); do | |
| if [ "$DB" = "information_schema" ] | |
| then | |
| echo Skipping $DB | |
| continue | |
| fi | |
| echo -n Dumping $DB... | |
| /usr/bin/mysqldump --add-drop-database --add-drop-table --single-transaction --routines --triggers $DB | gzip > "/var/backups/mysql/$DB-$(date '+%Y%m%e').sql.gz"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE users ( | |
| username VARCHAR(255) NOT NULL, | |
| password VARCHART(255) NOT NULL, -- bcrypt, column width is not optimized | |
| realm VARCHAR(255) NOT NULL DEFAULT 'rikmeijer.nl', | |
| PRIMARY KEY (username), | |
| UNIQUE (username, realm) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| /** | |
| * Nextcloud - Social Support | |
| * | |
| * This file is licensed under the Affero General Public License version 3 or | |
| * later. See the COPYING file. |
OlderNewer