Skip to content

Instantly share code, notes, and snippets.

do not pull or push

Torsten Brieskorn bitkorn

View GitHub Profile
View datatables_sort_date.php
forech($datas as $data) {
echo '<td data-sort="' . date('Y-m-d', $data['unixtimefield']).'">' . date('d.m.Y', $data['unixtimefield']) . '</td>';
bitkorn / custom-nav-walker-usage.php
Created May 13, 2018 — forked from kosinix/custom-nav-walker-usage.php
WordPress: Using a custom nav walker to create navigation menus in plain <a> tags. That is the <ul> and <li> tags are not present. Very useful if you want to create simple links that can be centered with a simple text-align:center on the containing element.
View custom-nav-walker-usage.php
// In your template files like footer.php
// The items_wrap value ('%3$s') removes the wrapping <ul>, while the custom walker (Nav_Footer_Walker) removes the <li>'s.
wp_nav_menu(array('items_wrap'=> '%3$s', 'walker' => new Nav_Footer_Walker(), 'container'=>false, 'menu_class' => '', 'theme_location'=>'footer', 'fallback_cb'=>false ));
bitkorn / image_encode_base64.php
Last active Mar 31, 2018
image encode Base64 PHP
View image_encode_base64.php
$filename = 'anhaenger.jpg';
//$filename = 'anhaenger.png';
$path = 'img/' . $filename;
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
file_put_contents('base64/' . substr($filename, 0, (strrpos($filename, '.'))), $base64);
echo $base64;
bitkorn / svg_from_file_with_d3.js
Created Mar 8, 2018
SVG from file with D3.js
View svg_from_file_with_d3.js
const fs = require('fs');
const d3 = require('d3');
const D3Node = require('d3-node');
var jsdom = require('jsdom');
const { JSDOM } = jsdom;
var contents = fs.readFileSync(__dirname + '/data/rectangle_100.svg', 'utf8');
// console.log(contents);
const dom = new JSDOM(contents);
// console.log(dom.window.document.querySelector('svg').outerHTML);
bitkorn / multiple_namespaces_in_a_file.php
Last active Feb 13, 2018
only functions are separated with multiple namespaces in a file
View multiple_namespaces_in_a_file.php
namespace A {
$closure = function () {
echo __NAMESPACE__;
namespace B {
$closure = function () {
View zf2_controller-with-viewHelper.php
namespace MyApp\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use \Zend\View\Model\ViewModel;
use Zend\View\Model\JsonModel;
class IndexController extends AbstractActionController
View php_baseurl.php
$baseUrl = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/'))) . '://' . $_SERVER['SERVER_NAME'];
bitkorn / js_stringToUpperFirst.js
Created Aug 5, 2017
make the first character to upper letter
View js_stringToUpperFirst.js
function stringToUpperFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
bitkorn / ZF2_log-SQL-string-with-driver-support.php
Created Jul 23, 2017
ZF2 log SQL string with driver-support
View ZF2_log-SQL-string-with-driver-support.php
namespace BitkornShop\Table\Basket;
use Zend\Db\Adapter\Adapter;
use Zend\Db\ResultSet\HydratingResultSet;
use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Adapter\AdapterAwareInterface;
bitkorn / zf2_short_fetch_all_tablex.php
Last active Feb 24, 2017
Short way to fetch all from SQL database with ZF2 \Zend\Db\Adapter\Adapter (no ZF2 \Zend\Db\TableGateway\AbstractTableGateway).
View zf2_short_fetch_all_tablex.php
namespace Foo;
use Zend\Db\Adapter\Adapter;
use Zend\Db\Adapter\ParameterContainer;
class A
You can’t perform that action at this time.