Skip to content

Instantly share code, notes, and snippets.

View vojtech-dobes's full-sized avatar

Vojtěch Dobeš vojtech-dobes

View GitHub Profile
<div n:class="tab-pane, $tab == 'content' ? active" id="component-{$id}-{$tab}">
{snippet tab}
{include #content}
{/snippet}
</div>
@vojtech-dobes
vojtech-dobes / bootstrap.php
Created September 4, 2012 11:48
ExtensionsList, hack for Nette 2.0.0-4 because of https://github.com/nette/nette/pull/720
<?php
$config = __DIR__ . '/config/config.neon';
$configurator->addConfig($config, FALSE);
foreach (Nette\Utils\Arrays::get(Nette\Utils\Neon::decode(
file_get_contents($config)
) ?: array(), 'extensions', array()) as $name => $class) {
$configurator->onCompile[] = function ($configurator, $compiler) use ($name, $class) {
$compiler->addExtension($name, new $class);
@vojtech-dobes
vojtech-dobes / editor.html
Created September 3, 2012 08:27
Distraction-less text editor
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<style>
body { width: 100%; margin: 0; padding: 20xp; height: 100%; position: relative; }
div {
color: #555555;
cursor: text;
display: block;
@vojtech-dobes
vojtech-dobes / MultiAuthenticator.php
Created August 31, 2012 12:40
Multiple ways of authentication in Nette
<?php
namespace VojtechDobes\NetteSecurity;
use Nette\InvalidArgumentException;
use Nette\Security\IAuthenticator;
use Nette\Security\IIdentity;
/**
@vojtech-dobes
vojtech-dobes / script.js
Created August 28, 2012 19:45
mcdonalds-piss-off-script
var timeout = 60;
var pause = 5;
var active = false;
function getLastLogin() {
var cookies = document.cookie.split(";");
for (i in cookies){
var cookie = cookies[i].split("=");
if ($.trim(cookie[0]) == 'lastLogin') return cookie[1];
}
@vojtech-dobes
vojtech-dobes / Control.php
Created August 27, 2012 08:56
Independent forms in Nette: UI\Form x UI\Control
<?php
use Nette\Application\UI;
class Form extends UI\Control
{
protected function createComponentForm()
{
$form = new UI\Form;
@vojtech-dobes
vojtech-dobes / add_pull_request_to_issue_github.sh
Created June 22, 2012 12:29 — forked from JanTvrdik/add_pull_request_to_issue_github.sh
Add pull request to existing issue on github
#!/bin/bash
current_branch="$(git symbolic-ref HEAD 2>/dev/null)" || current_branch="(unknown)"
current_branch=${current_branch##refs/heads/}
if [[ $current_branch = "(unknown)" ]]
then
echo "Unable to determine current branch!"
exit 1
fi
@vojtech-dobes
vojtech-dobes / string-helper.php
Created June 19, 2012 10:57
Fluent Strings Helper for Nette Framework
<?php
/**
* Fluent Strings Helper for Nette Framework
*
* @author Vojtěch Dobeš <me@vojtechdobes.com>
* @license WTFPL
*/
class StringObject
{
@vojtech-dobes
vojtech-dobes / selenium-kill.bat
Created June 10, 2012 21:39
How to switch off Selenium Server
wmic path win32_process Where "CommandLine Like '%selenium-server.jar%'" Call Terminate