- Create a base Controller class (usually just Controller.php)
- Extend you Controllers (e.g. DefaultController.php or AuthenticationController.php) with the base Controller class
- Add the @Route("/route", name="route_name") annotation to your methods' DocBlock
- Initialize the URLMatcher
- ???
- Profit
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 | |
$offset = 0; | |
$count = 50; | |
$domain = $argv[1]; | |
$tagged = isset($argv[2]) ? $argv[2] : false; | |
$api = 'http://' . $domain . '.tumblr.com/api/read/json?debug=1&num=' . $count . ($tagged ? '&tagged=' . $tagged : ''); | |
function scrape ($api, $count, $offset) { |
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 | |
if (version_compare(PHP_VERSION, '7.0.0') < 0) { | |
die('PHP 7 is required; your version is ' . PHP_VERSION); | |
} | |
$extensions = get_loaded_extensions(); | |
$requiredExtensions = [ | |
'json', |
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 Session | |
{ | |
private $db = false; | |
public function __construct() | |
{ | |
$this->db = new \Medoo\Medoo(); // http://medoo.in |
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 | |
/** | |
* Source: https://www.jodyhatton.com/how-big-is-my-website-how-to-get-a-list-of-all-files-and-folders-directories-using-php/ | |
*/ | |
$pathLen = 0; | |
function prePad($level) | |
{ | |
$ss = ""; | |
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
/.idea/ | |
/.git/ | |
/vendor/ | |
/var/* | |
!/var/cache | |
/var/cache/* | |
!var/cache/.gitkeep | |
!/var/lock | |
/var/lock/* |
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
# From: https://github.com/nitin42/Python-Automation/blob/master/project15.py | |
# Brute-Force PDF Password Breaker | |
# Brute-Forcing the pdf files to break the encryption using dictionary attack | |
import os | |
import PyPDF2 |
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
// Install NuGet package WindowsAPICodePack-Shell by Aybe | |
// | |
// using Microsoft.WindowsAPICodePack.Dialogs; | |
CommonOpenFileDialog dialog = new CommonOpenFileDialog(); | |
dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | |
dialog.IsFolderPicker = true; | |
if (dialog.ShowDialog() == CommonFileDialogResult.Ok) | |
{ | |
Debug.WriteLine(dialog.FileName); |
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
// just an example object | |
MyObj obj = // receive from somewhere | |
object temp = new object(); | |
PropertyInfo[] properties = typeof(obj).GetProperties(); | |
foreach (PropertyInfo property in properties) | |
{ | |
var name = property.Name; // gets the name of the property as a string | |
var value = property.GetValue(temp, null); // get the value of the property |
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 | |
// reading data from any source | |
$array = call_procedure_here(); | |
$output = '<?php' . PHP_EOL . '$myarray = ' . var_export($array, true) . ';' . PHP_EOL . '?>'; | |
file_put_contents(__DIR__ . '/cache/cache_file.php', $output); | |
// include in other files | |
include __DIR__ . '/cache/cache_file.php'; | |
?> |