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 / NetteCsvResponse.php
Created May 29, 2017 10:37 — forked from VladaHejda/NetteCsvResponse.php
Nette CSV response
<?php
namespace Nette\Application\Responses;
use Nette;
/**
* CSV download response.
* Under New BSD license.
*
@Kcko
Kcko / autosave.js
Created July 12, 2017 17:51 — forked from d3nj3ll/autosave.js
Client-side Autosave Using localStorage with jQuery in textarea
$(document).ready(function() {
///////////////////////
//
// Recovery Below
//
///////////////////////
// Retrieve the object from storage onReady
var autosave = localStorage.getItem('file');
@Kcko
Kcko / autosave.js
Created July 12, 2017 17:52 — forked from gcmurphy/autosave.js
Very simple autosave functionality using local storage
var AutoSave = (function(){
var timer = null;
function getEditor(){
var elems = document.getElementsByTagName("textarea")
if (elems.length <= 0)
return null;
@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
/* This parent can be any width and height */
.block {
text-align: center;
/* May want to do this if there is risk the container may be narrower than the element inside */
white-space: nowrap;
}
/* The ghost, nudged to maintain perfect centering */
.block:before {
@Kcko
Kcko / Com.latte
Created April 17, 2018 20:02 — forked from Kedrigern/Com.latte
Nette: Ajaxové ovládání komponenty
{* Component template *}
<div style="border-style: solid; border-width: 1px;">
<h4>Komponenta</h4>
<p>Jméno komponenty: {$control->name}</p>
{snippet com}
<p>Čas vykreslení:{$time|date:'%H:%M:%S'}</p>
{/snippet}
<p><a n:href="refresh!" class="ajax">REFRESH (invalidování)</a></p>
</div>
@Kcko
Kcko / jQuery.stringify.js
Created May 11, 2018 14:48 — forked from chicagoworks/jQuery.stringify.js
jQuery.stringify() utility
/**
* 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({
@Kcko
Kcko / DateTime.php
Last active May 25, 2018 16:14 — forked from 66Ton99/DateTime.php
DateTime
<?php
namespace MyNamespace;
$date = new ADateTime('2018-03-28');
$date->sub(new \DateInterval('P1M'));
echo $date->format('Y-m-d') . "\n";