This file contains 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
// document.ready without js | |
document.addEventListener("DOMContentLoaded", function(event) { | |
//do work | |
}); |
This file contains 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); | |
// this may be defined in the enviroment, not in the code. | |
// or can we find a system path for auto setup persistent cache ? | |
define('CACHE_FILE_TEMPLATE','/home/seb/.cache/test_php_{file}.txt'); | |
// usage : get some data : get('the key') // return some string content | |
print 'get("the stuff to fetch") -> "'.get('some stuffx.').'"'.PHP_EOL; | |
// you can also use the 'tool' functions |
This file contains 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); | |
/** | |
* Writes messages to stderr or stdout. | |
* | |
* @author Sébastien Monterisi <https://gist.github.com/SebSept/> | |
* @throws FailureToWriteToFile | |
*/ | |
function stdErr(string $message): void { stdLog('php://stderr', $message); } | |
function stdOut(string $message): void { stdLog('php://stdout', $message); } |
This file contains 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
<html> | |
<head> | |
<script type="text/javascript"> | |
document.addEventListener("DOMContentLoaded", (event) => { | |
console.log('hello') | |
}) | |
</script> | |
</head> | |
<body> | |
<button>Action !</button> |
This file contains 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 | |
/** | |
* playground | |
* | |
* functionnal use is at the bottom. | |
* | |
* Don't damn me, that's a playground. | |
*/ | |
class Pipe { |
This file contains 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 | |
class BackupDatabaseCronModuleFrontController extends ModuleFrontController | |
{ | |
public function init() | |
{ | |
try { | |
$this->checkAccess(); | |
$this->module->cron(); | |
header( "backup ok", true ,200 ); |
This file contains 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 | |
/** | |
* check sendtoafriend module vulnerability | |
* | |
* run it in terminal | |
* | |
* @link https://blog.seb7.fr/a/faille-sécurité-prestashop-module-envoyer-a-un-ami | |
* @author seb7.fr | |
*/ |
This file contains 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 | |
/** | |
* This is just a simple example how to use mikey179/vfsStream - https://github.com/mikey179/vfsStream | |
* | |
* Don't be fooled by the documentation. | |
* This lib is great but the documentation can let you thinks it's complicated or not 'natural' filesystem usage. | |
* This lib register a php stream so you can (almost) use filesystem function in a regular fashion. | |
* | |
* @see http://php.net/manual/en/book.stream.php | |
* @see http://php.net/manual/en/stream.streamwrapper.example-1.php |
This file contains 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 | |
/** | |
* Class DbPDOCore | |
* | |
* /override/classes/db/DbPDO.php | |
* @since 1.5.0.1 | |
*/ | |
class DbPDO extends DbPDOCore | |
{ |
This file contains 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/env php | |
<?php | |
/** | |
* add files to .gitignore. | |
* Put this file in your bin dir (/home/<username>/bin/), make it executable (chmod +x /home/<username>/bin/gitingore.php). Done. | |
**/ | |
// remove script name | |
array_shift($argv); | |
// arguments are file name | |
$files = $argv; |