Skip to content

Instantly share code, notes, and snippets.

View severak's full-sized avatar

Mikoláš Štrajt severak

View GitHub Profile
@severak
severak / fw.txt
Last active October 3, 2017 11:01
// čtení z DB
$rows->getOne($table, $where)
$rows->count($table, $where)
$rows->getMore($table, $where, $order)
$rows->getPage($table, $where, $order, $pageNo, $perPage)
$total = $rows->pageCount; // vyplněno po volání getPage, jinak obsahuje -1
// úpravy DB
$rows->insert($table, $data)
@severak
severak / magicquotes.php
Created August 15, 2017 13:55
magic quotes emulation
<?php
// backward compatible emulation of magic quotes
if (!get_magic_quotes_gpc()) {
// This replicates magic_quotes_gpc in PHP 5.4+
foreach($_POST as $_key => $_val){
if (is_string($_val)) {
$_POST[$_key] = addslashes($_val);
} elseif (is_array($_val)) {
foreach ($_val as $_subkey=>$_subval) {
@severak
severak / zmasakruj.php
Created June 27, 2017 12:21
svg inliner
<?php
// u SVG aplikuje třídy definované v <style> do polygonů a cest
function parseStyles(SimpleXMLElement $svg)
{
// var_dump($classByName);
$classesRaw = array();
preg_match_all('/\.(.*?)\{(.*?)\}/', (string) $svg->defs->style, $classesRaw);
@severak
severak / kostely.txt
Created April 28, 2017 12:03
kostely Praha - overpass api
// kostely Praha
[out:json][timeout:25];
// gather results
(
area[name="Praha"]->.prague;
way(area.prague)["amenity"="place_of_worship"];
way(area.prague)["amenity"="place_of_worship"];
);
// print results
out center;
inkscape/gravit:
72 dpi
148mm = 419.527px
1mm = 2.83px
---
mpdf:
@severak
severak / sizes.php
Last active March 14, 2017 10:04
code which determines object size in mPDF
<?php
// mpdf sizes code
//
// extracted from mpdf itsel
//Scale factor
define('_MPDFK', (72 / 25.4));
class mpdf {
@severak
severak / catstream.log
Created February 10, 2017 09:47
resoup install log
C:\mv>git clone https://[email protected]/severak/resoup.git catstream
Cloning into 'catstream'...
remote: Counting objects: 392, done.
remote: Compressing objects: 100% (364/364), done.
remote: Total 392 (delta 110), reused 0 (delta 0)
Receiving objects: 100% (392/392), 2.36 MiB | 1.26 MiB/s, done.
Resolving deltas: 100% (110/110), done.
Checking connectivity... done.
Checking out files: 100% (221/221), done.
@severak
severak / import.log
Created February 8, 2017 23:05
resoup import log
pi@raspberrypi:~/Desktop/severak/resoup $ php import.php
ERROR
Bad import parameters.
Please specifiy:
- RSS file
- destination username
pi@raspberrypi:~/Desktop/severak/resoup $ php import.php backup/soup_severak_2015-09-16.rss severak
Blog not found, creating it...
importing your feed...
OK
-- Kyselo/Resoup DB schema
-- public part
CREATE TABLE blogs (
id INTEGER PRIMARY KEY,
name TEXT UNIQUE,
title TEXT,
about TEXT,
avatar_url TEXT,
--Yet another SOUP.IO downloader/backup tool
--------------------------------------------------------------------------------
--Written by Severak, released with MIT license.
--Feel free to modify.
--
--Example of usage:
--
--lua5.1 soup.lua moomins.soup.io
--(last 20 from public rss)
--lua5.1 soup.lua http://www.soup.io/export/your-secret-hash.rss