Skip to content

Instantly share code, notes, and snippets.

View h4cc's full-sized avatar

Julius Beckmann h4cc

  • ZENNER IoT Solutions
  • Hamburg, Germany
View GitHub Profile
@h4cc
h4cc / howoto.md
Created August 10, 2014 18:12
Steps needed to use a alterantive terminal programm with `nautlius-open-terminal`

Install a alternative terminal like "terminator":

sudo apt-get install terminator

Because nautilus-open-terminal has hardcoded list of terminals, we need to replace a terminal that will use the same call arguments we need. For terminator it is "gnome-terminal" with '-x'.

Removing gnome-terminal

<?php
/**
* Will handle downloads for $_REQUEST['file']
* @author Julius Beckmann
*/
function handleForcedDownloads($parameterName='file', $exit=true)
{
if(isset($_REQUEST[$parameterName])) {
@h4cc
h4cc / install.txt
Last active August 29, 2015 14:05
Apache2.2 HHVM configuration for FastCGI
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your webserver talk to HHVM
* over FastCGI. Install nginx or Apache, and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*

Keybase proof

I hereby claim:

  • I am h4cc on github.
  • I am h4cc (https://keybase.io/h4cc) on keybase.
  • I have a public key whose fingerprint is 4F47 C034 9E5B A6CB EE9C 97AB 3706 6E33 73B0 0E61

To claim this, I am signing this object:

<?php
namespace foo {
define('foo\true', 'yes');
if('yes' === true) {
echo "true has ben overwritten to 'yes' for this namspace!\n";
}
}
@h4cc
h4cc / zend-framework-2.md
Last active August 29, 2015 14:08
Things a liked and disliked about Zend Framework 2

Things a liked and disliked about Zend Framework 2

Just some notes, dont take anything here serious...

Liked

  • Route Annotations via extra Modules.
  • Everything from one Framework.

Disliked

@h4cc
h4cc / match.php
Last active August 29, 2015 14:10
lambdalicious match function example
<?php
require_once __DIR__ . '/../src/Verraes/Lambdalicious/load.php';
function match(...$pairs)
{
return function ($value) use ($pairs) {
// No recursion yet, just for testing and demonstration purposes.
foreach ($pairs as $pair) {
$pattern = $pair->first;
$fun = $pair->second;
@h4cc
h4cc / out.txt
Created December 27, 2014 18:45
HHVM after install output
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your webserver talk to HHVM
* over FastCGI. Install nginx or Apache, and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*
sudo apt-get update
sudo apt-get install munin-plugins-extra
cd /etc/munin/plugins
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_bytes
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_counters
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_rates
sudo aptitude install libcache-memcached-perl
sudo /etc/init.d/munin-node restart
sudo tail -f /var/log/munin/munin-node.log
@h4cc
h4cc / Frau.php
Last active August 29, 2015 14:13
PHP Lösung des Heiratsproblems.
<?php
class Frau extends Person {
public function antragVon(Mann $mann) {
// Den erstbesten Man immer nehmen.
if(!$this->isVerlobt()) {
$this->verlobtMit = $mann;
return true;
}