Instantly share code, notes, and snippets.

View example.php
<?php
1)
$videoLength = $video->addText('videoLength', 'Délka videa');
$videoLength->addConditionOn($form['article-published'], Form::EQUAL, TRUE)
->setRequired();
$videoLength->addCondition(Form::FILLED)
->addRule(Form::PATTERN
View lambda.php
<?php
->addCondition(function() use ($form) {
return ...; //true nebo false
})
View 1
<?php
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Rating panel via CSS 3 & jQuery">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<style id="jsbin-css">
View some-component-default.latte
{control footerContactForm templateConfig => ['btn_contact_form' => $data->btn_contact_form != '' ? $data->btn_contact_form : 'Odeslat dotaz']}
View demo.js
1)
var Abc = function(aProperty,bProperty){
this.aProperty = aProperty;
this.bProperty = bProperty;
this.init = function(){
// Do things here.
}
this.init();
};
var currentAbc = new Abc(obj,obj);
View DateTime.php
<?php
namespace MyNamespace;
$date = new ADateTime('2018-03-28');
$date->sub(new \DateInterval('P1M'));
echo $date->format('Y-m-d') . "\n";
View closure.html
<p id="demo">0</p>
<script>
var add = (function () {
var counter = 0;
return function () {return counter += 1;}
})();
function myFunction(){
document.getElementById("demo").innerHTML = add();
View jQuery.stringify.js
/**
* converted stringify() to jQuery plugin.
* serializes a simple object to a JSON formatted string.
* Note: stringify() is different from jQuery.serialize() which URLEncodes form elements
* UPDATES:
* Added a fix to skip over Object.prototype members added by the prototype.js library
* USAGE:
* jQuery.ajax({
View example.html
// CLICK on button
<div class="box">
<button>Button</button>
</div>
$( "body" ).on( "click", ".box", function(e) {
e.delegateTarget; // body
e.currentTarget; // .box