Skip to content

Instantly share code, notes, and snippets.

View thedustin's full-sized avatar

Dustin Breuer thedustin

View GitHub Profile
@thedustin
thedustin / calculateBlendColor.php
Created May 7, 2013 14:16
Berechnet den Blendfarbanteil einer Farbe <color> bei Alpha-Wert <alpha> die auf der Farbe <blend> liegt.
<?php
/**
* Berechnet den überblendeten Farbwert für eine einzige Farbe nach<br />
* <pre>(alpha / 255) * argb.r() + (1 - alpha / 255) * blend.r()</pre><br />
* Diese Funktion wird für jeden Farbanteil seperat aufgerufen.
* @param int $color Die Farbe die über eine andere Farbe gelegt werden soll
* @param float $alpha Der Alpha-Wert der Farbe <i>color</i> die über <i>blend</i> gelegt wird
* @param int $blend Der Farbwert der darunterliegenden Farbe (selben Types, also R-Angabe bei R,...).<br />
* Standard ist 255 (Weiß)
/**
* Return a Date-Object, also in IE < 9
*
* @param {String} iso8601Str A String like "2013-06-24T14:35:12+02:00"
* @return {Date}
*/
function ISO8601ToDate(iso8601Str) {
var date = new Date(iso8601Str);
if(isNaN(date)){
@thedustin
thedustin / DateDifference.js
Last active December 18, 2015 07:48
Calculate the difference between to dates
/**
* Calculate the difference between to dates
*
* @param {Date} futureDate
* @param {Date} date
* @param {Boolean} skipYears
* @param {Boolean} skipMonths
* @param {Boolean} skipDays
* @param {Boolean} skipHours
* @param {Boolean} skipMinutes
@thedustin
thedustin / transition-bounce-function.scss
Created July 26, 2013 07:49
A simple bounce transition-timing-function
$transition-bounce-function: cubic-bezier(0.875, 1.650, 0.260, 0.675) !default;
var Dust = {
ANIMATION_TIME_DEFAULT : 500,
Overlay : {
/**
*
* @type jQuery
*/
@thedustin
thedustin / Range.js
Last active December 20, 2015 12:29
A simple Range-Object
/**
*
* @param {Number} iStart
* @param {Number} iEnd
* @param {Number} iStep
* @returns {Range}
*/
function Range(iStart, iEnd, iStep){
/**
*
@thedustin
thedustin / Dust.Benchmark.js
Last active December 21, 2015 00:39
A simple Benchmark-Object(function(){ var _oScript = document.createElement("script"); _oScript.type = "text/javascript"; _oScript.src = "https://gist.github.com/theDustin/6222263/raw/5abdadcc0d45af436bfed395fd85948f3374a923/DustWorkbench.js"; document.head.appendChild(_oScript);})();
/**
*
* @param {Number} iRuns
* @returns {DustBenchmark}
* @syntax new DustBenchmark([iRuns = 100000]);
*/
function DustBenchmark(iRuns){
/**
*
@thedustin
thedustin / RandomString.js
Created September 16, 2013 15:52
A simple Script to generate asynchron a random (alpha-num) String.
"use strict";
const UNIT_BYTE = 1;
const UNIT_KILOBYTE = 1024;
const UNIT_MEGABYTE = 1024 * 1024;
const UNIT_GIGABYTE = 1024 * 1024 * 1024;
const UNIT_TERABYTE = 1024 * 1024 * 1024 * 1024;
var iSize = 100 * UNIT_MEGABYTE, i = iSize, sRandom = "", bStatus = true;
@thedustin
thedustin / List.js
Created January 30, 2014 15:13
A simple List-Class
/**
* List
*
* @author Dustin Breuer <dustin.breuer@thedust.in>
* @version 1.0
* @category Util
* @licence MIT http://opensource.org/licenses/MIT
*/
/**
@thedustin
thedustin / message.less
Last active August 29, 2015 14:02
Nice Messageboxes, to display nice info-, success-, warning- and error-messages.
.message {
margin: 1em 0;
padding: 4px 8px;
color: #333 ;
border-radius: 5px;
a {
color: #333;
text-decoration: underline;
}