Skip to content

Instantly share code, notes, and snippets.

@nimmneun
nimmneun / BungieClient.php
Created September 24, 2016 10:45
Sloppy way to fetch characters of a player bungie api
<?php
/**
* Class BungieClient ... really quick and dirty way.
*/
class BungieClient
{
/**
* @var array
*/
@nimmneun
nimmneun / FontMeta.php
Last active December 26, 2024 19:08
Read / extract meta data like actual font name, font family, font subfamily, etc from ttf font files
<?php
/**
* Class FontMeta based on several stackoverflow answers.
*
* @method string getCopyright()
* @method string getFontFamily()
* @method string getFontSubFamily()
* @method string getFontIdentifier()
* @method string getFontName()
@nimmneun
nimmneun / OsmMapParser.php
Created July 7, 2016 06:38
openstreetmap node, way, relation extractor
<?php
class OsmMapParser
{
const TYPE_NODE = 'node';
const TYPE_WAY = 'way';
const TYPE_RELATION = 'relation';
private $source;
private $target;
@nimmneun
nimmneun / OsmNodeParser.php
Last active July 6, 2016 23:40
openstreetmap nodes die einen bestimmten suchstring enthalten in neues file schreiben
<?php
class OsmNodeParser
{
private $spl;
private $current;
private $isOpen = false;
private $hasQuery = false;
private $nodes = [];
@nimmneun
nimmneun / paracurl.php
Created November 11, 2015 00:03
simple multi_curl based function with ability to set a limit on the max number of concurrent connections
<?php
/**
* Process any number of cURL requests in parallel, but limit
* the number of simultaneous requests to $parallel.
*
* @param array $urls Array with URLs to process
* @param int $parallel Number of concurrent requests
* @param array $extraOptions User defined CURLOPTS
* @return array[]
*/
@nimmneun
nimmneun / OrderAggregate.php
Created October 14, 2015 06:18
Oversimplified Order Aggregate ... just trying stuff *lol
<?php
/**
* @inherits ArrayAccess, IteratorAggregate, Countable from Collection
* @author neun
* @since 12.10.2015 22:24
*/
class OrderAggregate extends Collection
{
/**
* @var Order
@nimmneun
nimmneun / baker.php
Created September 28, 2015 23:35
quick and dirty console snippet to create basic models & tables
<?php
/**
* @author neun
* @since 28.09.2015 20:16
*/
if (PHP_SAPI == 'cli') {
if (3 > count($argv)) {
print_r(" bake:[type] [name] [property1,property2,...]\n repo\t : Creates new repository".
"\n model\t : Creates new model\n [bake:model User id,name,email,created,updated,deleted]");
} else {
@nimmneun
nimmneun / Query.php
Last active October 20, 2016 08:49
Simple MySQL query builder
<?php namespace MonoQuery;
/**
* Uber simple single table query builder.
*
* @author neun
* @since 27.09.2015 15:35
*/
class Query
{
private $table;
<?php
/**
* Retrieves data and curl connection info for an array of one or more urls
* using curl_multi_*. Input order & array key equal output order & array key.
* Returns 2-dimensional array containing url data & curl info.
* @param array $urls
* @return array $res
*/
function multicurl($urls) {
<?php
/**
* @author nimmneun
* @since 02.07.2015 22:31
*/
class CsvReader
{
private $delimiter;
private $enclosure;
private $escape;