Skip to content

Instantly share code, notes, and snippets.

🤖
Working

Dominik Wilkowski dominikwilkowski

🤖
Working
Block or report user

Report or block dominikwilkowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dominikwilkowski
dominikwilkowski / gist:8968451
Last active Aug 29, 2015
Simple MySQLi abstraction layer into associative array
View gist:8968451
<?php
/*****************************| MYSQLI CONNECTION FUNCTION |*****************************/
/**
* Simple MySQLi abstraction layer
*
* @param resource $mysqli The MySQLi connection link
* @param string $query The MySQL query for prepaired statement
* @param array $v The parameters to replace ? in $query. First element must be the type
* @param integer $o Option for more debug infos [0]=no infos(default) [1]=adding debug infos
*
@dominikwilkowski
dominikwilkowski / gist:8968459
Last active Aug 29, 2015
TINY SYSTEM MESSAGE GATHERER
View gist:8968459
<?php
/*****************************| SYSTEM MESSAGE FUNCTION |*****************************/
/**
* TINY SYSTEM MESSAGE GATHERER
*
* addMsg($msg,$o)
* @param string $msg Message to be added
* @param int $o Urgency [0](default)=normal [1]=warning [2]=error [3]=no HTML wrapper
*
* getMsg()
@dominikwilkowski
dominikwilkowski / gist:8968469
Last active Aug 29, 2015
TINY FILE UPLOAD ABSTRACTION LAYER
View gist:8968469
<?php
/*****************************| UPLOAD FILES |*****************************/
/**
* TINY FILE UPLOAD ABSTRACTION LAYER
*
* @param object $sysMsg System Message object
* @param string $el Name of _FILE element
* @param string $name Name of new file
* @param string $kind Kind of upload ["image"|"pdf"]
* @param array $dim Dimension of image [0]=width [1]=height
@dominikwilkowski
dominikwilkowski / gist:8968477
Last active Aug 29, 2015
TINY STING TO URL CLEANER (Handleizer)
View gist:8968477
<?php
/*****************************| STRING TO URL |*****************************/
/**
* TINY STING TO URL CLEANER
*
* @param string $t String to be converted
*
* @return string string stripped off of all characters but A-Za-z0-9 and dash, spaces are converted to dash
*/
function makeURL($t) { return strtolower(substr(preg_replace("/[^\w-]+/","",str_replace(" ","-",$t)),0,20)); }
@dominikwilkowski
dominikwilkowski / gist:8968493
Last active Aug 29, 2015
TINY TRUNCATE WORD FUNCTION
View gist:8968493
<?php
/*****************************| TRUNCATE WORDS |*****************************/
/**
* TINY TRUNCATE WORD FUNCTION
*
* @param string $t String to be shortened
* @param int $count Number of words to output
* @param boolen $dots Add dots at the end with string is larger than $count. (optional) [default=true]
*
* @return string of $count words with added dots
@dominikwilkowski
dominikwilkowski / make-image.liquid
Created Feb 13, 2014
This snippet lookes at its input string and returns either the input or a fallback image in a specific size, no path though
View make-image.liquid
{% comment %}
This snippet lookes at its input string and returns either the input or a fallback image in a specific size, no path though
Usage:
{% assign newImageSize = "medium" %} (optional)
{% include 'make-image' with imageString %}
Return:
{{ newImageSize }} (either as input or fallback)
@dominikwilkowski
dominikwilkowski / for-looper.liquid
Created Feb 13, 2014
This snippet displays "is-first" or "is-last" within a loop for class names
View for-looper.liquid
{% comment %}
This snippet displays "is-first" or "is-last" within a loop for class names
Usage:
{% for p in collection.products %}
<li class="{% include 'for-looper' %}"> ... </li>
{% endfor %}
Return:
no return
@dominikwilkowski
dominikwilkowski / runAdminer.php
Created Feb 25, 2014
Run Adminer with custom Session class (in database rather than file system)
View runAdminer.php
<?php
include('php/ini.php'); //get mySQL settings
$SESSIONTAB = 'session'; //table for PHP sessions
/*****************************| MYSQLI CONNECTION FUNCTION |*****************************/
/**
* Simple MySQLi abstraction layer
*
* @param resource $mysqli The MySQLi connection link
* @param string $query The MySQL query for prepaired statement
@dominikwilkowski
dominikwilkowski / gist:68e8ab71952a235eb127
Last active Aug 29, 2015
JS animate to auto function
View gist:68e8ab71952a235eb127
jQuery.fn.animateHeightAuto = function(speed, callback) {
var height;
return this.each(function(i, $element) {
var $this = $( $element );
var heightBackup = $this.css('height');
$this.css({
@dominikwilkowski
dominikwilkowski / show-sizes.liquid
Last active Aug 29, 2015
Convert variant dropdown into swatches, one-option-sollution
View show-sizes.liquid
{% comment %}
This snippet displays sizes
Usage:
{% include 'show-sizes' with product %}
Return:
no return
Required:
You can’t perform that action at this time.