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
<div id="bellend" class="bellend hidden">STOP THAT</div> | |
<style> | |
.hidden { | |
display:none; | |
} | |
.bellend { | |
background: #000; | |
color: #FFF; | |
height: 100%; |
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 | |
// This code shouldn't actually be *here*, obviously | |
$theme = filter_input(INPUT_POST, 'theme', FILTER_VALIDATE_REGEXP, [ | |
'options' => [ | |
'regexp' => '/^pink|blue|whatever$/', | |
], | |
]); | |
if ($theme) { | |
// Persist the theme somehow (just session here, but could be cookie or user profile) |
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 | |
/** | |
* Doctrine DBAL server storage class for LEOP's OAuth2 server library | |
* | |
* Why? Because the built-in one uses zetacomponents/database and the rest of | |
* your app uses Doctrine2 ORM or DBAL. Using this DBAL implementation offers | |
* no other advantages; zetacomponents/database and doctrine/dbal are roughly | |
* equivalent. | |
*/ | |
namespace Inanimatt\OAuth2\Server\Storage\DBAL; |
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 | |
require_once __DIR__.'/vendor/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
$request = Request::createFromGlobals(); | |
$dirty_html = $request->get('dirty_input'); | |
$config = HTMLPurifier_Config::createDefault(); |
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 | |
namespace Acme\DemoBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class ImportCSVCommand extends ContainerAwareCommand |
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 | |
$dir = new DirectoryIterator('/Users/matt/Projects/Domain-Calendar'); | |
$files = new RegexIterator($dir, '/^composer/'); | |
foreach($files as $file) { | |
echo $file->getPathName().PHP_EOL; | |
} |
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 | |
class CSVIterator extends SPLFileObject | |
{ | |
protected $first_row = true; | |
protected $columns; | |
public function __construct ($filename, $delimiter = ',') | |
{ | |
parent::__construct($filename); |
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 | |
/** | |
* Test if given file is a web image (gif/jpg/png) | |
* | |
* Requires PHP 5.3 or newer (builtin) or the Fileinfo PECL extension. | |
* | |
* @param string $file Path to image | |
* @return boolean True if web image, or false if unreadable or not image | |
*/ |
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/bash | |
# Will add --dry-run unless the --go option is set. All other arguments passed to rsync (e.g. --delete) | |
SOURCE=. | |
DEST=example.com:/var/www/mysite | |
DRYRUN="--dry-run" | |
args=() | |
for var in "$@" |
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 | |
// Zend Mail | |
use Zend\Mail; | |
$mail = new Mail\Message(); | |
$mail->setBody('This is the text of the email.'); | |
$mail->setFrom('[email protected]', 'My site'); | |
$mail->addTo('[email protected]', 'Their name'); | |
$mail->setSubject('Test Subject'); |