Skip to content

Instantly share code, notes, and snippets.

View tomasfejfar's full-sized avatar
🏠
Working from home

Tomáš Fejfar tomasfejfar

🏠
Working from home
View GitHub Profile
oxy.layout.right({}, function() {
out.printHtml('\n <div class="watchDogBox">\n ');
if (accountName != null) {
out.printHtml('\n <div class="popup_watcherNews">\n <a href="#" class="wd">Hlídací pes pro novinky v kategorii</a>\n ');
oxy.popup.insert({categoryId:( currentCategory.id),name:"watcherNews",expirationOptions:( expirationOptions)});
out.printHtml('\n </div>\n ');
} else {
...
}
}
@tomasfejfar
tomasfejfar / gist:1384029
Created November 21, 2011 21:37
DIC & DICProxy
<?php
class DICProxy
{
public function __construct($dic, $className) {
//set to private members
}
public function __call($method, $args)
{
return $dic->giveMe($className)->$method($args); //super-simplified
app.views.Viewport = Ext.extend(Ext.Panel, {
initComponent: function() {
//put instances of cards into app.views namespace
Ext.apply(app.views, {
question : new app.views.Question(),
articlesList : new app.views.ArticlesList(),
articlesDetail: new app.views.ArticlesDetail()
/*videos : new app.views.Videos(),
events : new app.views.Events(),
tags : new app.views.Tags(),
<?php
class Crud_Filter_ValueProcessor_Text extends Crud_Filter_ValueProcessor_Abstract
{
public function isValidFormat($value)
{
return true;
}
public function process($column, $value) {
if ($column->isExactMatch()) {
@tomasfejfar
tomasfejfar / Google.php
Created November 10, 2012 13:07 — forked from Mikulas/Google.php
GoogleAuth
<?php
use \Nette\Utils\Json;
/**
* Minimalistic Google OAuth2 connector
* @author Mikuláš Dítě
* @license BSD-3
*/
class Google extends Nette\Object
@tomasfejfar
tomasfejfar / gist:4051035
Created November 10, 2012 13:18
Truncating text, keeping full sentences
text = "Were you born 1. 3. 1987 in Prague? Štěpán Jr. lives there for 3 years now! "
expectedResult = "Were you born 1. 3. 1987 in Prague?"
trimText(input = text, characterLimit = 50) == expectedResult
@tomasfejfar
tomasfejfar / mux.sh
Last active December 10, 2015 21:08
Mux SQL files
#!/bin/bash
rm -f ./mux.sql;
rm -f ./tmp.list;
RES=`echo ""`
ITEM=`echo ""`
for file in `git ls-files`
do
HASH=`git rev-list HEAD $file | tail -n 1`
DATE=`git show -s --format="%ct" $HASH --`
ITEM=$(printf "%s %s\n" $DATE $file >> tmp.list)
@tomasfejfar
tomasfejfar / gist:4708522
Created February 4, 2013 18:24
Nasty bug/fail in Zend_View_Abstract
<?php
/**
* Clear all assigned variables
*
* Clears all variables assigned to Zend_View either via {@link assign()} or
* property overloading ({@link __set()}).
*
* @return void
*/
public function clearVars()
@tomasfejfar
tomasfejfar / setup-vpn.sh
Last active December 16, 2015 01:19
Fork of https://raw.github.com/cwaffles/ezpptp/master/ezpptp.sh Simple script to start PPTP VPN on debian I tried to fix to work on my virtual
#!/bin/bash
# Interactive PoPToP install script for an OpenVZ VPS
# Tested on Debian 5, 6, and Ubuntu 11.04
# April 2, 2013 v1.11
# Author: Commander Waffles
# http://www.putdispenserhere.com/pptp-debian-ubuntu-openvz-setup-script/
 
echo "######################################################"
echo "Interactive PoPToP Install Script for an OpenVZ VPS"
echo
@tomasfejfar
tomasfejfar / salt-cmd.sh
Created April 11, 2013 17:53
Useful Salt stack commands
# last job
sudo salt-run jobs.list_jobs | tac | grep -P ^'.*':$ -m 1 -B 9999 | tac