Skip to content

Instantly share code, notes, and snippets.

View janmarek's full-sized avatar

Jan Marek janmarek

  • Prague, Czech Republic
View GitHub Profile
<?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
class OfferFinder extends Blabla
{
public function whereTags(array $tags)
{
if (count($tags) === 0) {
return;
}
$ids = array_map(function ($tag) {
{# 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>
class Singleton
{
private static Singleton inst;
public Singleton (String password)
{
if (!password.equals("tajne heslo")) {
throw new Exception("Nemuzes vyrobit instanci :-P");
}
}
(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)))
@janmarek
janmarek / DoctrineQueryBuilderBuilder.php
Created October 10, 2012 17:43
DoctrineQueryBuilderBuilder
/**
* @author Jan Marek
*
* @method QueryBuilderBuilder andWhere() andWhere(\mixed $where)
* @method QueryBuilderBuilder orderBy() orderBy(\string $sort, \string $order = null)
* @method QueryBuilderBuilder from() from(\string $from, \string $alias, \string $indexBy = null)
* @method QueryBuilderBuilder select() select(\string $select = null)
* @method QueryBuilderBuilder addSelect() addSelect(\string $select = null)
* @method QueryBuilderBuilder setMaxResults() setMaxResults(\int $maxResults)
* @method QueryBuilderBuilder setFirstResult() setFirstResult(\int $firstResults)
<?php
/**
* @param \Doctrine\ORM\EntityManager $entityManager
* @param \Namespace\FooRepository $fooRepository
* @param \Namespace\BarRepository $barRepository
*/
public function __construct(EntityManager $entityManager, FooRepository $fooRepository, BarRepository $barRepository)
{
...
@janmarek
janmarek / bootstrap.css
Last active December 15, 2015 08:29
Bootstrap zkompilovaný Lessem pro PHP a pro JS
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
line-height: 0;
}
@janmarek
janmarek / FocusDirective.js
Created September 23, 2013 16:32
Angular focus directive
function FocusDirective() {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ctrl) {
// add inputCtrl to scope
scope[ctrl.$name + 'InputCtrl'] = ctrl;
ctrl.$focused = false;
ctrl.enableEvents = true;
element.bind('focus', function (evt) {
@janmarek
janmarek / twitter.css
Last active August 29, 2015 13:56
twitter
.global-nav-inner .container {width: 890px;}
.topbar-tweet-btn button {margin-right: 0 !important}
h1.Icon--bird {display: none !important}
// black header if you want it
.global-nav-inner {background: black;}
.nav>li>a, .nav .active a {color: #EEE}