Skip to content

Instantly share code, notes, and snippets.

View DASPRiD's full-sized avatar

Ben Scholzen DASPRiD

View GitHub Profile
------------------------------------------------------------------------------
To be added (Zend\I18n namespace):
View helpers:
- DateFormat <DASPRiD>
- NumberFormat <cgmartin>
- Currency <cgmartin>
------------------------------------------------------------------------------
Convert to work with DateTime, Intl extension and/or Zend\I18n\Translator:
<?php
/**
* Check if a message is translated.
*
* @param string $message
* @param string $textDomain
* @param string $locale
* @return boolean
*/
public function isTranslated($message, $textDomain = 'default', $locale = null)
<?php
$locale = 'en-US';
$formatter = new IntlDateFormatter($locale, null, null, null, null, 'MMMM');
$date = new DateTime('1970-01-01');
$monthNames = array();
for ($monthNo = 1; $monthNo <= 12; $monthNo++) {
$monthNames[] = $formatter->format($date);
$date->modify('+1 month');
@DASPRiD
DASPRiD / gist:6126256
Last active December 20, 2015 11:49
Prepending a route programatically.
<?php
$statusRoute = $routeStack->getRoute('status');
$versionRoute = new Segment('/v:version');
$chainRoute = new Chain(array($versionRoute, $statusRoute), $routeStack->getRoutePluginManager(), null);
$routeStack->removeRoute('status'); // Not really required, as addRoute() will override this anyway… just for completeness.
$routeStack->addRoute('status', $chainRoute);
@DASPRiD
DASPRiD / Tweets
Created October 27, 2013 19:33
Collection of accident tweets.
Ben Scholzen ‏@DASPRiD 1 Sep 11
Just had a bike crash with a car :(
Ben Scholzen ‏@DASPRiD 1 Sep 11
@cogocogo I were on the bike, yes. Head wound and something on the arm broken
Ben Scholzen ‏@DASPRiD 1 Sep 11
@sprunka already in the hospital
Ben Scholzen ‏@DASPRiD 1 Sep 11
From 81d9e159d2bd5bffbf573a9c502e96be9df9311a Mon Sep 17 00:00:00 2001
From: Ben Scholzen <mail@dasprids.de>
Date: Fri, 1 Nov 2013 01:03:12 +0100
Subject: [PATCH] Add chunk decoding (hard-coded for now, should be
header-dependent)
---
src/Sslurp/MozillaCertData.php | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
#!/bin/bash
CARD_INDEX=0
PROFILE_SPEAKERS='output:iec958-stereo'
PROFILE_HEADPHONES='output:analog-stereo'
CURRENT_PROFILE=$(LANG=C \
pactl list cards \
| grep -E '^Card #|Active Profile:' \
| sed ':a;N;$!ba;s/\(Card #[0-9]*\)\n/\1: /g' \
#!/bin/bash
# Timelapse script by Ben Scholzen 'DASPRiD'
# Licensed under the Simplified BSD License
# http://opensource.org/licenses/BSD-2-Clause
FFPROBE=/usr/bin/ffprobe
FFMPEG=/usr/bin/ffmpeg
SOXI=/usr/bin/soxi
SPLASH_LENGTH=5
@DASPRiD
DASPRiD / text.php
Last active August 29, 2015 13:59 — forked from bakura10/text.php
<?php
$routes = [];
if ($_SERVER['ENV'] === 'production') {
$options = ['hostname' => 'connect.mysite.com', 'secure' => true];
} else {
$options = ['hostname' => 'connect.localhost.com'];
}