Skip to content

Instantly share code, notes, and snippets.

View Kedrigern's full-sized avatar

Ondřej Profant Kedrigern

View GitHub Profile
@Kedrigern
Kedrigern / prvocisla.pas
Created October 21, 2012 17:21
Prvočísla (test, eratoshenovo síto) v Pascalu....
{Author: Ondřej Profant, 2009}
unit prvocisla;
interface
Const MaxN = 10000; // konec Eratosthenova Síta
Type SITO = array [2..MaxN] of boolean;
function Prvocislo(j: integer): boolean;
@Kedrigern
Kedrigern / model.php
Created October 31, 2012 16:53
OOP model dodavatele v eshopu
<?php
namespace test;
class objednavkaDopravaInfo
{
public $kg;
public $psc;
public $typ;
public $dostupnost; // dostupnost u nas
@Kedrigern
Kedrigern / finace.php
Created November 1, 2012 18:20
Náčrt vypořádání se s různými měnami a s operacemi vzniklými z toho
<?php
/**
* Author: Ondřej Profant, 2012
*/
namespace finance;
/**
* Náhrada za výčtový typ.
* Definuje konstanty pro jednotlivé měny.
@Kedrigern
Kedrigern / kombinatorika.cs
Created December 18, 2012 10:23
Základy kombinatoriky implementované v C#. Dole je readme.
using System;
namespace kombinatorika
{
class MainClass
{
public static void Main (string[] args)
{
Console.Write ("Hello World!\nPočet hodnot (jazyk): ");
int n = 4;//int.Parse( Console.ReadLine() );
@Kedrigern
Kedrigern / HomepagePresenter.php
Created January 29, 2013 16:38
Hrátky s form replikátorem z Nette
/*
* Tento příklad vychází z Sandbox z http://addons.nette.org/cs/form-container-replicator
* resp. správně nastavené rozlišení form replikator
*/
<?php
use Nette\Forms\Container;
use Nette\Application\UI\Form;
/**
@Kedrigern
Kedrigern / Com.latte
Last active March 14, 2023 00:04
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>
@Kedrigern
Kedrigern / @layout.latte
Last active April 7, 2016 19:25
Modální okna vyplňována dynamicky AJAXem bez JS kodu :)
{**
* My Application layout template.
*
* @param string $basePath web base path
* @param string $robots tell robots how to index the content of a page (optional)
* @param array $flashes flash messages
*}
<!DOCTYPE html>
<html>
@Kedrigern
Kedrigern / NumberMatching.php
Last active December 16, 2015 11:48
Regexp matchich if string with street name has orientation number too.
<?php
/**
*
* Regexp matchich if string with street name has orientation number too.
* Rules are for Czech Republic orientation numbers:
* a) number for 0-999
* b) may be supplemented by one letter
* @link http://www.czso.cz/csu/rso.nsf/i/cislo_orientacni
*
@Kedrigern
Kedrigern / mails.php
Last active December 16, 2015 12:19
Extract mail address in pointy brackets ("<", ">") from given string
<?php
/**
*
* Extract mail address in pointy brackets ("<", ">") from given string
*
* @author: Ondřej Profant <ondrej.profant <> gmail.com>, 2013
*
*/
@Kedrigern
Kedrigern / HomepagePresenter.php
Last active March 26, 2016 09:20
Multiple file upload for Nette framework via HTML5 FormData (Ajax).
<?php
/**
* Homepage presenter.
*/
class HomepagePresenter extends BasePresenter
{
public function handleProcessImages()
{
$files = $this->getHttpRequest()->getFiles();