Skip to content

Instantly share code, notes, and snippets.

View vojtech-dobes's full-sized avatar

Vojtěch Dobeš vojtech-dobes

View GitHub Profile
@mislav
mislav / backfill-releases.sh
Created February 5, 2014 17:37
Script to migrate releases from CHANGELOG.md to GitHub Releases
#!/bin/bash
# Usage: OAUTH_TOKEN="..." backfill-releases CHANGELOG.md [<project-title>]
set -e
log="${1?}"
project_name="${2}"
repo="$(git config remote.origin.url | grep -oE 'github\.com[/:][^/]+/[^/]+' | sed 's/\.git$//' | cut -d/ -f2-3)"
[ -n "${project_name}" ] || project_name="${repo#*/}"
@hrach
hrach / solution.sql
Last active August 29, 2015 14:02
@hrachcz: #anketa. model: author 1:n books m:n tags. zajima me sql, ktere vybere autory, kteri nenapsali zadnou knihu o PHP (tj. bez tagu PHP).
select *
from authors
where not exists (
select *
from books
left join books_x_tags on (books_x_tags.book_id = books.id)
left join tags on (tags.id = books_x_tags.tag_id)
where
books.author_id = authors.id
and tags.name = 'PHP'
@vojtech-dobes
vojtech-dobes / format-pre.js
Created January 22, 2015 10:00
Make <pre> readable
[].slice.call(document.querySelectorAll('pre'), 0).forEach(function (el) {
el.innerHTML = el.innerHTML.split("\n").join('<br>');
});
var style = document.createElement("style");
style.appendChild(document.createTextNode(""));
document.head.appendChild(style);
style.sheet.insertRule("pre { white-space: normal }", 0);
<?php
namespace Metis\Tester;
use Nette\Object;
use Tracy\Dumper;
class TestingServer extends Object {
public $onOutput;
@vaclavbohac
vaclavbohac / jQuery.mobile.formfix.js
Created June 16, 2011 15:48
AJAX forms in Nette FW and jQuery mobile
/**
* Formfix enables you to use AJAX forms with Nette FW
* and helps keep tracking of history in jQuery mobile.
*
* Requires jQuery 1.4+, jQuery mobile 1.0
*
* Usage:
* $("#foo").formfix();
*
* @author Vaclav Bohac <bohac.v@gmail.com>
@paulirish
paulirish / 1-tablemarkup.html
Created August 1, 2011 01:38
whitespace use for html/css readability
<!-- formatting fun #1: tables! -->
<!-- use whitespace to mimic the layout you want. leave off optional end tags for readability -->
<table>
<caption>Selector engines, parse direction</caption>
<thead>
<tr><th>Left to right <th>Right to left
<tbody>
<tr><td>Mootools <td>Sizzle
/**
* Beta
*
* Sibling of netteForms.js "rewritten to jQuery"
* @author Pavel Kučera
* @author David Grudl author of netteForms.js, of the idea and the one who I copied from
*
* Disclaimer: I'm not a javascript programmer, actually I hate javascript, so consider that please if you want to complain about quality of this utility.
*
* Dependencies
@abtris
abtris / widgets.js
Created January 29, 2012 10:38
mapy.cz
/**
* Input type - address with autocomplete and reverse geocoding using Seznam maps API.
*/
angular.inputType('address', function(element) {
var scope = this;
// full address data from geocoder for angular model
var address = {};
// parse input value and set into model
@kaja47
kaja47 / phplisp.php
Created May 3, 2012 17:31
Object oriented system made only from functions
<?php
// If you want to make an object oriented system from scratch, you must first create the universe.
// Only things you need are functions
function cons($h, $t) {
return function($what) use($h, $t) {
return ($what[0] === 'h') ? $h : $t;
};
}
@LeonardoCA
LeonardoCA / AjaxPanels.php
Created July 13, 2012 21:22
AjaxPanelsCompilerExtension
<?php
/**
* This file is part of the AjaxPanels Nette Addon
*
* Copyright (c) 2012 Leonard Odlozilik
*
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*/