Instantly share code, notes, and snippets.

View pattern.js
;(function($) {
var privateFunction = function () {
//do something
}
var methods = {
init : function( options ) {
var defaults = {
center: {
View how-to-use.js
$(document).ready(function() {
//$('#post_message').keyup(debounce(postPreview, 250, {maxWait: 3000}));
// Fire scroll code after 250ms of idleness
$(window).add('.trigger-scroll-handler').scroll(debounce(scrollHandler, 250, { maxWait: 1000 }));
// Trigger once explicitly, so content in viewport is loaded when user did not yet scroll
jQuery(document).trigger('scroll');
});
View form-factory.php
<?php
declare(strict_types=1);
namespace App\Forms;
use Nette;
use Nette\Application\UI\Form;
use Nette\Security\User;
final class SignInFormFactory
{
View form-factory.php
<?php
declare(strict_types=1);
namespace App\Forms;
use Nette;
use Nette\Application\UI\Form;
use Nette\Security\User;
final class SignInFormFactory
{
View partial-rendering.latte
<div class="col-12">
{!$form['agreement']->getOneLabel('basic')->startTag()}
{$form['agreement']->getOneControl('basic')}
{!_'Souhlasím zpracování'}
{!$form['agreement']->getOneLabel('basic')->endTag()}
</div>
<div class="cl"></div>
<div class="h15"></div>
View add-component.php
<?php
$form->addComponent(
new Nette\Forms\Controls\TextInput('Firma'),
'billing_name',
'billing_firstname' // insertBefore arg
);
View config.neon
$mailer = new SendmailMailer; 1)
$mailer = new Nette\Mail\SmtpMailer(array( 2)
'host' => 'smtp.savana.cz',
'username' => 'podpora@cardbook.cz',
'password' => 'uL$g4GHl6AR'
));
$mailer->send($mail);
3)
View filter.php
<?php
$form->addText('zip', 'PSČ:')
->addCondition($form::FILLED)
->addFilter(function ($value) {
return str_replace(' ', '', $value);
});
View like.php
<?php
$con->table('table_name')->where('name LIKE ?',new \Nette\Database\SqlLiteral($con->getSupplementalDriver()->formatLike('John Doe', 0)));
$con->table('table_name')->get(1)->update(array('updated_at'=>new \Nette\Database\SqlLiteral('NOW()')))
View helper.latte
{block|helper}{control controlNamel}{/block}