Android: Resize screen for dead touch zone

Unfortunately I recently stumbled upon hardware issues with my OnePlus One. About 1 inch (2,5 cm) of the display and the soft buttons stopped working suddenly. The display itself is fully intact, but it does not respond to any touch events or gestures anymore. As this leaves the device unusable for most interactions, I desperately searched for a solution on how to disable the defect part of the display. Especially as interaction with the on-screen nav bar is not possible due to the unresponsive 1 inch (2,5cm) high display part. So I basically had to find a way how to “push” the on-screen nav bar up a bit.

Continue reading →

Docker: Error opening terminal: unknown.

Executing bash in a running Docker container via docker exec -it [container] bash intending to edit a file with nano (or any other of those spiffy editors) might result in bash refusing to do its job.

Error opening terminal: unknown.

Thankfully there are some smart folks out there, who traced the TERM variable as the underlying troublemaker. Therefore assigning xterm as the variable’s value resolves the complications:

export TERM=xterm

dompdf: Explicit page break via CSS (page-break-*)

Switching from TCPDF to dompdf – due to image rendering / scaling / quality difficulties with TCPDF – I (unsurprisingly) stumbled upon some differences how dompdf handles the provided HTML. One of which is the way explicit page breaks can be accomplished. TCPDF expects you to use a special pagebreak attribute:

Whereas dompdf pays attention to the page-break-* CSS properties. A TCPDF-style replacement for an explicit page break might look like this:

PHP: Delayed Redirect with message without Meta refresh

Messing around with dompdf I tried to show a little teaser right before downloading a generated PDF file. Using WordPress I initially thought about simply putting a Meta refresh into the head by using a suitable hook:

Actually I stumbled upon a simpler and imho cleaner solution to implement a delayed redirect with a nice message:

Git: Create an unrelated / orphan / disconnected branch

git checkout [-q] [-f] [-m] --orphan  []

Create a new orphan branch, named <new_branch>, started from <start_point> and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits.

[…]

This can be useful when you want to publish the tree from a commit without exposing its full history. […]

If you want to start a disconnected history that records a set of paths that is totally different from the one of <start_point>, then you should clear the index and the working tree right after creating the orphan branch by running git rm -rf . from the top level of the working tree. […]

Source: http://git-scm.com/docs/git-checkout/

git checkout --orphan newbranch  
git rm -rf .  
[...]
git add files  
git commit -m 'Initial commit'  

Source: http://stackoverflow.com/a/4288660