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
<form action="." method="post"> | |
<noscript>You must <a href="http://www.enable-javascript.com" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript> | |
<input | |
type="submit" | |
value="Pay with Card" | |
data-key="PUBLISHABLE STRIPE KEY" | |
data-amount="500" | |
data-currency="cad" | |
data-name="Example Company Inc" |
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 | |
$prime = function($num) { | |
if ($num === 1) { | |
return false; | |
} | |
if ($num === 2) { | |
return true; | |
} |
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 | |
/** | |
* The __halt_compiler() function will stop the PHP compiler when called. | |
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt. | |
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating. | |
* The template is stored in a temporary file so it can be included and parsed. | |
* | |
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php | |
* http://php.net/manual/en/function.halt-compiler.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
<VirtualHost *:80> | |
ServerName example.dev | |
DocumentRoot /var/www/vhosts/www.example.com/public | |
# Enable Rewrite Log Debugging (Apache 2.2) | |
RewriteLog /var/www/vhosts/www.example.com/rewrite.log | |
RewriteLogLevel 6 | |
# Enable Rewrite Log Debugging (Apache 2.4) | |
# LogLevel alert rewrite:trace6 |
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 | |
function parse_youtube_embed($embed) { | |
if (empty($embed)) { | |
return false; | |
} | |
$dom = new DOMDocument; | |
if (! $dom->loadHTML($embed)) { | |
return false; | |
} |
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 | |
// See: http://stackoverflow.com/questions/2803321/and-vs-as-operator | |
// http://www.php.net/manual/en/language.operators.precedence.php | |
$foo = true; | |
$bar = false; | |
$truthiness = $foo && $bar; | |
echo ($truthiness ? 'TRUE' : 'FALSE'); // FALSE |
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
{# Form Theme #} | |
{# See: https://github.com/symfony/symfony/blob/2.0/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig #} | |
{# See: http://stackoverflow.com/questions/10043251/how-to-add-a-css-class-on-a-form-row-in-twig-template #} | |
{% form_theme form _self %} | |
{# Field Row #} | |
{# - Add 'error' class to form widgets. #} | |
{# - Display errors below widgets. #} | |
{% block field_row %} |
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 | |
namespace Ziadoz\Validator\Constraints; | |
use Symfony\Component\Validator\Constraint; | |
/** | |
* @Annotation | |
*/ | |
class ContainsHtml extends Constraint | |
{ |
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
$.fn.extend({ | |
// ---- HTML Comments ---- // | |
comments: function() { | |
return $(this).contents() | |
.filter(function() { | |
return this.nodeType == 8; | |
}); | |
}, | |
// ---- Outer HTML ---- // |
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 Post | |
{ | |
protected $table = 'posts'; | |
/** | |
* You can define your own custom boot method. | |
* | |
* @return void | |
**/ |