Skip to content

Instantly share code, notes, and snippets.

View dapepe's full-sized avatar

Peter Haider dapepe

View GitHub Profile
@dapepe
dapepe / cli.php
Last active April 28, 2017 12:10
Utility functions to work with Command Line Interfaces
<?php
/**
* Utility functions to work with Command Line Interfaces
*
* @author Peter-Christoph Haider
*/
/**
* Initilizes CLI arguements
@dapepe
dapepe / excel.utils.php
Last active July 14, 2023 17:28
Utility functions to parse and generate Excel files using PHPexcel
<?php
/**
* Utility functions to parse and generate Excel files using PHPexcel
*
* @author Peter-Christoph Haider
*/
/**
* Parses an excel file into an array
@dapepe
dapepe / array.sort.php
Created February 4, 2014 09:13
Sort an array by key
<?php
/**
* Sorts an array by key
*
* @param array $arrData
* @param string $strKey
* @param bool $bolAsc
*/
function sortArray($arrData, $strKey, $bolAsc=true) {
@dapepe
dapepe / array.check.php
Created February 4, 2014 09:14
Checks if an array is associative or numeric
<?php
/**
* Checks if an array is associative or numeric
*
* @param array $arr
*/
function isAssoc($arr) {
return is_array($arr) ? (array_keys($arr) !== range(0, count($arr) - 1)) : false;
}
@dapepe
dapepe / Gruntfile.js
Last active August 29, 2015 13:56
Simple Gruntfile.js for LESS parsing and development mode
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
distFolder: 'dist',
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'dist/<%= pkg.name %>.js',
@dapepe
dapepe / TextTable.php
Last active September 20, 2024 07:26
Class to generate a Markdown-style table from a PHP array
<?php
/**
* Creates a markdown document based on the parsed documentation
*
* @author Peter-Christoph Haider <peter.haider@zeyon.net>
* @package Apidoc
* @version 1.00 (2014-04-04)
* @license GNU Lesser Public License
*/
@dapepe
dapepe / sqlitedump.php
Created March 24, 2016 07:15
Display a dump for an SQLite file
#!/usr/bin/env php
<?php
if ( !isset($argv[1]) ) {
fputs(STDERR, 'Usage: '.basename($argv[0]).' <sqlite-file>'."\n");
exit(1);
}
$dbFile = $argv[1];
@dapepe
dapepe / sqlitediff.php
Created March 24, 2016 07:16
Use TortiseMerge to display the difference between two SQLite files
#!/usr/bin/env php
<?php
function dumpSqlite($database) {
$path = @tempnam(@sys_get_temp_dir(), 'sqlt');
if ( !$path )
return false;
$dump = @shell_exec('php '.escapeshellarg(dirname(__FILE__).DIRECTORY_SEPARATOR.'sqlitedump.php').' '.escapeshellarg($database));
if ( !empty($dump) and @file_put_contents($path, $dump) )
@dapepe
dapepe / pos.yaml
Created October 13, 2017 16:48
Configuration for SparkPOS
---
request:
url: http://192.168.157.143:50505
log:
error: log/error.log
default: log/default.log
rules:
- name: EAN scannen
input: ".*"
action:
@dapepe
dapepe / zeysdk-readme.md
Last active December 8, 2017 09:23
ZeySDK README

ZeyOS SDK CLI

First: GET /sync Then create the PATCH document

Installation