Skip to content

Instantly share code, notes, and snippets.

View janmarek's full-sized avatar

Jan Marek janmarek

  • Prague, Czech Republic
View GitHub Profile
(ns trees.core)
(require '[clojure.contrib.math :as math])
(use 'clojure.set)
; tools
(defn
^{:doc "get column from 2 dimensional array"
:test (fn []
(assert (= [0 1 2] (get-column [[2 0] [3 1] [1 2]] 1)))
class Singleton
{
private static Singleton inst;
public Singleton (String password)
{
if (!password.equals("tajne heslo")) {
throw new Exception("Nemuzes vyrobit instanci :-P");
}
}
{# použití #}
{# import makra, snad by to stačilo jednou v nějakém layoutu #}
{% from 'JmNecoBundle::macros.html.twig' import class_attr %}
{% set dataZDatabaze = ['prvni', 'druhy', 'treti', 'ctvrty', 'paty'] %}
<ul>
{% for item in dataZDatabaze %}
<li{{ class_attr({'lichy': loop.index is odd, 'posledni': loop.last}) }}>{{ item }}</li>
<?php
class OfferFinder extends Blabla
{
public function whereTags(array $tags)
{
if (count($tags) === 0) {
return;
}
$ids = array_map(function ($tag) {
<?php
/**
* This file is part of the Nette Framework (http://nette.org)
*
* Copyright (c) 2004, 2011 David Grudl (http://davidgrudl.com)
*
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*/
<?php
interface ITest {
}
class TestClass1 {
}
<?php
namespace Symfony\Component\Validator\Constraints;
/**
* @author Roman Sklenář, Jan Marek
* @link https://gist.github.com/664454
*/
class Unique extends \Symfony\Component\Validator\Constraint
{
<?php
// alt-shift zmena klavesnice EN->CS (QWERTY)
// ctrl-space code hints
// nekdo to spustte. nevime co to dela
namespace {
$users = array();
$val = isset($_GET['lorem']) ? intval($_GET['lorem']) : 0;
}
@janmarek
janmarek / LessFilter.php
Created November 11, 2010 21:45
LessFilter pro WebLoader
<?php
namespace Webloader;
use Nette\String, lessc;
/**
* Less CSS filter
*
* @author Jan Marek
@janmarek
janmarek / ServiceLoader.php
Created October 13, 2010 09:08
Dependency Injection Container konfigurovatelný neonem pro Nette
<?php
namespace Neuron;
use Nette\Environment, Nette\String;
use Nette\NeonParser;
use Nette\Reflection\ClassReflection;
use Nette\IContext;
/**