Skip to content

Instantly share code, notes, and snippets.

View Kedrigern's full-sized avatar

Ondřej Profant Kedrigern

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / Nejcastejsi.cs
Last active October 11, 2015 22:17
Zadání vypadalo: Čtěte vstupní textový soubor text.in a pro dvacet nejčetnějších slov v něm určete jejich četnost. Tato nejčetnější slova spolu s jejich četnostmi zapište na výstup v pořadí podle klesající četnosti. Pokud mají dvě různá slova shodnou četnost vypište je v abecedním pořadí.
/**
* Author: Ondřej Profant, 2010
* Velmi stará a špatná školní práce...
*/
using System;
using CodEx;
namespace Nejcastejsi
{
@Kedrigern
Kedrigern / zapliner.pas
Created October 21, 2012 16:35
Převod čísel na slovní vyjádření a obráceně.
{
# Copyright 2008 Ondřej "Kedrigern" Profant < ondrej.profant (*) gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@Kedrigern
Kedrigern / cleanDir.sh
Created September 8, 2012 22:20
Utility to clean/sort huge directories. For example for move all preview images (small files) from dir to another dir.
#/bin/bash
# Author: Ondřej Profant, 2012
# Mail: ondrej.profant <> gmail.com
# Licence: GPL
# Utility to clean/sort huge directories. For example for move all preview images (small files) from dir to another dir.
LICENCE=GPL
VERSION=0.1
DEFAULT_LIMIT=$((10 << 10)); #10kb
function help() {
@Kedrigern
Kedrigern / ss.sh
Created April 3, 2012 17:45
BASH: Sorted files from gived dirs by file's sufixes. And it is little bit complicated than just copy (for example see arg LIMIT etc.).
#!/bin/bash
# Author: Ondřej Profant, 2012
# Email: ondrej.profant <> gmail.com
# Licence: GPL
# Sorted files from gived dirs by file's sufixes. And it is little bit complicated than just copy (for example see arg LIMIT etc.).
# I use it as final step after PhotoRec recovery app.
# Sorry for Czech texts.
# TODO:
# -- cmd args
# -- clean code