Skip to content

Instantly share code, notes, and snippets.

View jakubkulhan's full-sized avatar

Jakub Kulhan jakubkulhan

View GitHub Profile
@jakubkulhan
jakubkulhan / Co bych chtěl od MongoDB GUI.md
Last active August 29, 2015 13:56
Co bych chtěl od MongoDB GUI

Co bych chtěl od MongoDB GUI

Zeptal jsem se, jestli existuje pěkný GUI klient pro MongoDB. Moc děkuji @abtris a @OzzyCzech za odpovědi.

Vyzkoušel jsem v rychlosti Mongo Hub i Robomongo. A je to... hrůza. Vždyť jsou ti klienti úplně k ničemu.

Co já chci od MongoDB klienta:

  • Table view. Absolutní nutnost. Rozklikávat si objekty a dívat se na jejich atributy - aka tree view? Jako vážně? Vždyť to je úplně k ničemu, na tohle víc než terminálového klienta nepotřebuji. (Mongo shell má navíc tu fičuru, že ve výchozím stavu má "expand all". Zato v Mongo Hubu i Robomongo se objekty zobrazují sbaleně, a aby toho nebylo málo, nenašel jsem, kde mají tlačítko na expand all.) Robomongo má table view, ale nepodporuje jednu důležitou věc. Pokud je nějaký sloupeček typu objekt, mus
@jakubkulhan
jakubkulhan / ocp.php
Created January 22, 2014 22:42 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
package info.kulhan.evented;
import java.lang.reflect.Method;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.BlockingQueue;
import android.util.SparseArray;
/**
* Inbox for receiving messages
@jakubkulhan
jakubkulhan / main.c
Created November 11, 2012 09:21
Druhé minimum
int min, min2; // min2 je druhé minimum
if (N < 2) {
// pořeš, když tam je míň jak dvě hodnoty
} else {
if (pole[0] < pole[1]) {
min = pole[0];
min2 = pole[1];
} else {
public class Main {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JPanel p = new HlavniPanel();
JFrame f = new JFrame();
@jakubkulhan
jakubkulhan / StdinLoader.java
Created October 29, 2012 13:02
loadPositiveInt() má zkoušet načítat číslo, dokud se nepodaří načíst kladné číslo. Čistší řešení?
/*
* loadPositiveInt() má zkoušet načítat číslo, dokud se nepodaří načíst kladné číslo.
*
* Takže pro následující kód:
*
* System.out.println("Zadejte kladné celé číslo:");
* int n = loadPositiveInt();
* System.out.println("Zadali jste: " + n);
*
* může komunikace s programem vypadat následovně:
@jakubkulhan
jakubkulhan / indent.pegjs
Created July 28, 2012 10:42
Python style indentation parser in PEG.js
// do not use result cache, nor line and column tracking
{ var indentStack = [], indent = ""; }
start
= INDENT? lines:( blank / line )*
{ return lines; }
line
= SAMEDENT line:(!EOL c:. { return c; })+ EOL?

Blog example

This Gist contains (incomplete) sources of what an implementation of blog in Jeph might look like when Jeph is completed and supports all needed functions (think of this code as soon-not-to-be-failing test).

First look at main.js, it creates some example data and calls jeph() with database-based handler. index.js creates blog's property model and sets basic transformations. archive.js, comment_aggregate.js, and post.js define transformations for blog/* types.

Transformations

What is an transformation anyway? It takes an entity and if the entity matches given conditions, it adds some properties to it. A condition is any property of transformation that is not a function. true matches when property is present, false if it is not present. String and number match if property has given value. For example, { "jeph/type": true } matches an entity if it has property called jeph/type, { "jeph/type": "blog/post" } matches if the property's value is string blog/post. (Quer

-module(mujobjekt).
-export([start/0, ahoj/4, zavislost1/0, zavislost2/0, zavislost3/0]).
zavislost1() ->
receive
{neco_udelej, Pid, Parametr} ->
Pid ! {mam_to, self(), Parametr + 1};
{mam_to_cele, {Vysledek1, Vysledek2, Vysledek3}} ->
io:format("~p, ~p, ~p~n", [Vysledek1, Vysledek2, Vysledek3])
@jakubkulhan
jakubkulhan / JavascriptParser.phpeg
Created June 6, 2012 22:23
Javascript parser for phpeg
program
= __ statements:(statement / function_declaration)* !.
-> count($statements) === 0 ? NULL : (count($statements) === 1 ? $statements[0] : array("block", $statements))
function_body
= statements:(statement / function_declaration)*
-> count($statements) === 0 ? NULL : (count($statements) === 1 ? $statements[0] : array("block", $statements))
function_declaration
= "function" _ name:identifier