Skip to content

Instantly share code, notes, and snippets.


Vít Šesták v6ak

View GitHub Profile
* Alias for {@link #set(Object)}
public void set(T value) {
v6ak /
Created Mar 2, 2010
example of a reasonable Singleton
package v6ak.util;
import java.util.Comparator;
public final class NaturalComparator {
private static final Comparator<? extends Comparable<?>> instance = new Comparator<Comparable<Object>>(){
public int compare(Comparable<Object> o1, Comparable<Object> o2) {
if( o1==null || o2==null ){
throw new NullPointerException("Comparing null values is not supported!");
v6ak / identity.php
Created Mar 4, 2010
PHP zval experiments
View identity.php
final class v6_Variable{
private $val;
public function set($val){
$this->val = $val;
View parse.c
#include <stdio.h>
#include <stdlib.h>
typedef int boolean;
///////////// abstract CharProcessor ///////////////////////////////////
typedef struct _CP{ // abstract
/*public abstract*/ struct _CP* (*nextFunction) (struct _CP *this, char c, FILE *out);
/*public virtual*/ void (*destroyFunction) (struct _CP *this);
/*private field*/ boolean canBeFinal;
package v6.micro.platforms;
public final class Platform {
private static final String JP_PREFIX = "JP-";
private Platform() {}
public static boolean isA200OrHigher() {
return isA200OrHigher(System.getProperty(""));
View EnumColumn.php
* Representation of enumerated grid column.
* @author Vít Šesták 'v6ak'
* @copyright Copyright (c) 2010 Vít Šesták
* @license New BSD License
* @package Nette\Extras\DataGrid
View cookies-parser.php
<?php // taková funkcionální pochoutka...
$expcook = explode('; ', $cookiesString);
$lincook = array_map(function($v){return explode('=', $v, 2);}, $expcook);
$cookies = array_combine(array_map(function($v){return $v[0];}, $lincook), array_map(function($v){return $v[1];}, $lincook));
v6ak / fragment-rc.xml
Created Sep 8, 2010
Switching tray in Openbox
View fragment-rc.xml
<keybind key="W-t">
<action name="Execute">
<name>qwitch tint</name>
View actual.php
// PHP fragment
// Code creates a multicomponent in Nette. The code is a bit ugly.
protected function createComponent($name){
$PFX = 'rating';
$PFXLEN = strlen($PFX);
if(substr($name, 0, $PFXLEN === $PFX){
return $this->createRating($name, substr($name, $PFXLEN));