Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Tomáš Fejfar tomasfejfar

🏠
Working from home
Block or report user

Report or block tomasfejfar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tomasfejfar
tomasfejfar / rebase-to-moved.sh
Last active Jul 29, 2019
"rebase" onto codebase that moved to different directory
View rebase-to-moved.sh
#! /bin/bash
# usage: rebase-to-moved.sh my-branch
# will create tag backup of current branch and rebase it on a moved directory
if [ -n "$(git status --porcelain)" ]; then
echo "You need to have clean working copy"
exit 1
fi;
git checkout $1
@tomasfejfar
tomasfejfar / register-phpstorm-folder.reg
Created Mar 18, 2019
Register PhpStorm in context menu of directory
View register-phpstorm-folder.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\PHP Storm]
@="Open in &PHP Storm"
"icon"="\"C:\\bin\\PhpStorm.cmd\""
[HKEY_CLASSES_ROOT\Directory\shell\PHP Storm\command]
@="\"C:\\bin\\PhpStorm.cmd\" \"%1\""
@tomasfejfar
tomasfejfar / composer.json
Created May 10, 2018
Local composer package
View composer.json
{
"repositories": [
{
"type": "path",
"url": "/path/to/project"
}
],
}
@tomasfejfar
tomasfejfar / docker-compose.yml
Created Apr 3, 2018
Using YAML to reuse parts of existing docker-compose configuration
View docker-compose.yml
version: "3"
services:
apache: &apacheConfig
build: .
volumes:
- ./:/var/www/html:cached
- ./docker/php-apache/php.ini:/usr/local/etc/php/php.ini
- ./docker/php-apache/ssl-local:/etc/httpd/ssl
working_dir: /var/www/html
ports:
@tomasfejfar
tomasfejfar / gist:5c92333b60143f189a69e8a9cde55811
Created May 29, 2017
Convert PDF to text file using tesseract and imagemagick in cygwin
View gist:5c92333b60143f189a69e8a9cde55811
Required cygwin packages:
* tesseract-ocr
* ghostscript
* imagemagick
usr/bin/convert.exe -density 400 input.pdf -depth 8 output.tiff
tesseract -l eng -psm 1 output.tiff output_textfile
View gist:30a8b7cc8f868da4045473cf06f87a0f
λ make serve
make[1]: Entering directory `W:/www/projects/flexproject'
/usr/bin/sh: make: command not found
make[1]: *** [serve_as_sf] Error 127
make[1]: Leaving directory `W:/www/projects/flexproject'
make: *** [serve] Error 2
@tomasfejfar
tomasfejfar / page-A4.css
Last active Aug 5, 2017
Style to create a page-like div with the exact measurements of A4 paper
View page-A4.css
@media screen {
.page {
background: white;
width: 18cm;
height: 27.7cm;
display: block;
margin: 0 auto;
margin-bottom: 0.5cm;
box-shadow: 0 0 0.5cm rgba(0, 0, 0, 0.5);
padding: 1cm 1.5cm;
@tomasfejfar
tomasfejfar / index.php
Last active Nov 16, 2016
Ošetření stránek pokud je vkládáme přímo z $_GET
View index.php
<?php
// v $page může být cokoli, nejen "kontakt" nebo nic. Takže potřebujeme zkontrolovat, že nám tam nepropadne něco co nechceme.
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'hlavni';
}
// uděláme pole se seznamem povolených hodnot
View db.php
<?php
$pdoOptions = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
];
$pdo = new PDO('mysql:host=127.0.0.1;dbname=blog', 'root', '', $pdoOptions);
$statement = $pdo->prepare("SELECT * FROM posts");
$statement->execute();
$posts = $statement->fetchAll(PDO::FETCH_ASSOC);
@tomasfejfar
tomasfejfar / sendmail.bat
Last active Nov 11, 2016
Windows fake sendmail to save mail to file
View sendmail.bat
@echo off
::where do we store the messages
SET mailpath=c:\xampp\tmp\mail\
if not exist %mailpath% mkdir %mailpath%
::create filename
echo %date:~0,11%
SET filename=%date:~11,4%-%date:~7,2%-%date:~3,2%_%hours%-%time:~3,2%-%time:~6,2%_%time:~9,2%
You can’t perform that action at this time.