Skip to content

Instantly share code, notes, and snippets.

View BlaM's full-sized avatar

Dominik Deobald BlaM

View GitHub Profile
@BlaM
BlaM / DES crypt.js
Created October 23, 2013 16:23 — forked from tyilo/DES crypt.js
/* JavaScript password hash generator.
* $Id: pwd.js,v 1.5 2004/10/09 09:41:38 emikulic Exp $
*
* Copyright (c) 2004, Emil Mikulic.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
@BlaM
BlaM / dabblet.css
Created January 6, 2014 13:42 — forked from LeaVerou/dabblet.css
(C)Leanest CSS spinner ever
/**
* (C)Leanest CSS spinner ever
*/
@keyframes spin {
to { transform: rotate(1turn); }
}
.progress {
position: relative;
@BlaM
BlaM / dabblet.css
Created January 6, 2014 13:43 — forked from LeaVerou/dabblet.css
Flexible Google-style progress indicator
/**
* Flexible Google-style progress indicator
*/
@keyframes progress {
50% { border-width: .5em 0; }
to { border-width: .5em 0 0 0; }
}
@keyframes rotate {
"atom-beautify":
prettyName: "Atom Beautify"
homepage: "https:\\atom.io\\packages\\atom-beautify"
"atom-bootstrap3":
prettyName: "Atom Bootstrap3"
homepage: "https:\\atom.io\\packages\\atom-bootstrap3"
"atom-hg":
prettyName: "Atom Hg"
homepage: "https:\\atom.io\\packages\\atom-hg"
"atom-html-preview":
@BlaM
BlaM / detect-flash-objects.js
Created August 25, 2016 12:49
Detect embedded flash objects on page (JavaScript)
function containsSWFObjects() {
var s,
selectors = [
'object param[name="movie"][value*=".swf"]',
'object param[name="src"][value*=".swf"]',
'embed[src*=".swf"]',
'object[data*=".swf"]'
];
while (s = selectors.pop()) {
@BlaM
BlaM / md5_base64.php
Created October 12, 2016 14:11 — forked from julienbourdeau/md5_base64.php
PHP: md5_base64 function
function md5_base64( $data ) {
return preg_replace('/=+$/','',base64_encode(pack('H*',md5($data))));
}
@BlaM
BlaM / parse-url.js
Last active March 2, 2017 09:15
parseURL
// This function creates a new anchor element and uses location
// properties (inherent) to get the desired URL data. Some String
// operations are used (to normalize results across browsers).
// @author: James Padolsey
// @url: https://j11y.io/javascript/parsing-urls-with-the-dom/
function parseURL(url) {
var a = document.createElement('a');
a.href = url;
<?php
// http://de.wikipedia.org/wiki/K%C3%B6lner_Verfahren
function SoundKoeln($str) {
$buf = preg_replace('/[0-9]+/', '', $str);
$buf = str_replace(array('DSC', 'TSC'), array('8', '8'), $buf);
if (substr($buf, 0, 2) == 'CL') $buf = '45' . substr($buf, 2);
if (substr($buf, 0, 2) == 'CR') $buf = '47' . substr($buf, 2);
$buf = str_replace(array('PH', 'CH', 'CK', 'CX', 'KX', 'QX', 'CA', 'CO', 'CU', 'DC', 'DS', 'DZ', 'SC', 'TC', 'TS', 'TZ'),
array('3', '4', '4', '4', '4', '40', '40', '40', '8', '8', '8', '8', '8', '8', '8', '8'),
@BlaM
BlaM / minify-html.php
Created March 23, 2017 13:05
Some old PHP code I use to minify HTML code.
<?php
function ob_end_flush_minified() {
$content = ob_get_contents();
ob_end_clean();
$content = minify_html($content);
echo $content;
}
@BlaM
BlaM / to-days.php
Created March 23, 2017 13:07
PHP implementation of mysql's TO_DAYS() and FROM_DAYS() functions
<?php
function TO_DAYS($date) {
if (is_numeric($date)) {
$res = 719528 + (int) ($date / 86400);
} else {
$TZ = date_default_timezone_get();
date_default_timezone_set('UTC');
$res = 719528 + (int) (strtotime($date) / 86400);
date_default_timezone_set($TZ);