Skip to content

Instantly share code, notes, and snippets.

View Kcko's full-sized avatar
🦜
fly like a bird ...

Roman Janko Kcko

🦜
fly like a bird ...
View GitHub Profile
@Kcko
Kcko / update-join.sql
Created August 31, 2017 09:37
Mysql update join
UPDATE table A
JOIN table B ON {join fields}
JOIN table C ON {join fields}
JOIN {as many tables as you need}
SET A.column = {expression}
Example:
UPDATE person P
JOIN address A ON P.home_address_id = A.id
JOIN city C ON A.city_id = C.id
@Kcko
Kcko / bootstrap-mixins.scss
Created October 5, 2017 13:53
Bootstrap mixins
@mixin respond($minWidth: 0, $maxWidth: 0) {
@if $minWidth and $maxWidth
{
@media screen and (min-width: $minWidth) and (max-width: $maxWidth) { @content; }
}
@else if $minWidth
{
@media screen and (min-width: $minWidth) { @content; }
}
@else if $maxWidth
@Kcko
Kcko / image-with-caption.js
Created October 6, 2017 11:28
Wrap image with caption
$(".img-left, .img-right, .article-detail img", this).each(function()
{
var image = $(this);
var imageCaption = image.attr("alt");
if (imageCaption != '')
{
image.wrap('<div class="image-w-caption">');
image.parent('.image-w-caption')
.css('max-width', image.width())
.addClass(image.attr('class'))
<form id="msgbox" action="#" method="get">
<fieldset>
<label for="msg">your message</label>
<input id="msg" value="" />
<button>SEND</button>
</fieldset>
</form>
@Kcko
Kcko / nette.php
Created February 1, 2018 09:09
nette, form, own rule
<?php
$cnew->addText("input1", "Jméno 1")->addRule(
function ($item, $arg){
return $item->value == "ano";
}
, 'Číslo musí být dělitelné %d.', 8);
jQuery.fn.extend({
insertAtCaret: function(myValue){
return this.each(function(i) {
if (document.selection) {
//For browsers like Internet Explorer
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus();
@Kcko
Kcko / BasePresenter.php
Created February 1, 2018 19:19 — forked from fprochazka/BasePresenter.php
Image pipe for #nettefw templates
<?php
/**
* @author Filip Procházka <[email protected]>
*/
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
/**
* @var \Img\ImagePipe
@Kcko
Kcko / control.php
Created February 2, 2018 11:20
nette, control, component, dynamic view, pohled, sablony
<?php
namespace App\FrontModule\Components;
use Nette\Application\UI,
Nette,
Nette\Mail\Message,
Nette\Mail\SendmailMailer,
App,
CardBook;
class PollControl extends Control
{
public function __construct(array $info)
{
$this->info = $info;
}
}
interface IPollControlFactory
{
/**
@Kcko
Kcko / new-element.js
Created February 5, 2018 15:06
new element jquery
// <a style="color: red;" onclick="..." href="https://phpfashion.com">blogísek</a>
var $el = $('<a>', {
href: url,
text: title,
click: function(e) {
alert(this.href);
},
css: {
color: 'red'
}