Skip to content

Instantly share code, notes, and snippets.

View davidfuhr's full-sized avatar

David Fuhr davidfuhr

  • esentri AG
  • Karlsruhe, Germany
View GitHub Profile
@davidfuhr
davidfuhr / gist:3270651
Created August 6, 2012 04:47 — forked from anonymous/gist:3260973
Dump all Session Related PHP ini Values
<?php
$ini = ini_get_all('session', false);
$ini['url_rewriter.tags'] = ini_get('url_rewriter.tags');
foreach($ini as $k => $v)
{
echo $k . ' = ' . $v . "\n<br/>\n";
}
.myform {
$label-width: 80px;
.form-horizontal .control-label {
width: $label-width;
}
.form-horizontal .controls {
margin-left: $label-width + 20px;
}
}
@davidfuhr
davidfuhr / php-install.sh
Last active December 18, 2015 17:59
A php install script for debian using the http://cr.yp.to/slashpackage.html directory structure. To install php 5.3.23 run "php-install.sh 5.3.23"
#!/bin/bash
PHPVERSION=$1
if [[ ! $1 =~ ^5\.[234]\.[0-9]{1,2}$ ]]; then
echo $PHPVERSION is not a valid php version.
exit
fi
INSTALL_PACKAGES=""
for PACKAGE in build-essential bzip2 gcc libbz2-dev libcurl3-openssl-dev libcurl4-openssl-dev libgd2-xpm-dev libicu-dev libmcrypt-dev libmhash-dev libmysqlclient-dev libxml2-dev libxslt1-dev libxslt1-dev make wget; do
@davidfuhr
davidfuhr / gist:7673553
Last active December 29, 2015 12:49
Finds zero datetime values in a mysql database
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE PROCEDURE `select_zero_date_columns`()
BEGIN
DECLARE current_table_name CHAR(255);
DECLARE current_column_name CHAR(255);
@davidfuhr
davidfuhr / gist:9364795
Last active October 28, 2019 11:08
git snippets
# delete all local merged branches with no activity within the last week
for k in $(git branch --merged | sed /\*/d); do
if [ -z "$(git log -1 --since='1 week ago' -s $k)" ]; then
echo git branch -d $k
fi
done
# delete all merged remote branches with no activity within the last month
for k in $(git branch -r --merged | cut -d ' ' -f3 | sed /\*/d); do
if [ -z "$(git log -1 --since='1 month ago' -s $k)" ]; then
@davidfuhr
davidfuhr / gist:90147d9e2d9d296f1775
Created July 16, 2014 09:03
KendoUI DataSource timestamp handling
transport: {
parameterMap: function (options, operation) {
if (operation === "update" || operation === "create") {
$.each(options, function (key, value) {
if (value instanceof Date) {
options[key] = Math.round(value.getTime() / 1000);
}
});
}
return options;
@davidfuhr
davidfuhr / hhvminfo.php
Last active August 29, 2015 14:08 — forked from ck-on/hhvminfo.php
<?php
/*
HHVMinfo - phpinfo page for HHVM HipHop Virtual Machine
Author: _ck_
License: WTFPL, free for any kind of use or modification, I am not responsible for anything, please share your improvements
Version: 0.0.6
* revision history
0.0.6 2014-08-02 display fix for empty vs zero
0.0.5 2014-07-31 try to determine config file from process command line (may not always work), style improvements
@davidfuhr
davidfuhr / gist:03a608d73bd7e2e28e39
Created November 29, 2014 11:56
phpunit.xml for symfony 2.7
<!-- Disable E_USER_DEPRECATED until 3.0 -->
<ini name="error_reporting" value="-16385"/>
<?php
namespace Pokus;
class Exception extends \Exception
{
}
function tttt($string)
{
try {
@davidfuhr
davidfuhr / jdk-install.sh
Created December 8, 2015 11:34
Extracts and installs jdk package
#!/bin/bash
set -eou pipefail
if [ ! -f "$1" ]; then
echo $1 is not readable.
exit 1
fi
TEMPDIR=`mktemp -d`