Skip to content

Instantly share code, notes, and snippets.

View wehowski's full-sized avatar

Melanie Wehowski wehowski

View GitHub Profile
@wehowski
wehowski / parseMime.php
Last active April 3, 2016 01:00
parseMime - MIME-Type fragments extractor [php] http://interface.api.webfan.de/v1/public/registry/type/
<?php
/**
* http://interface.api.webfan.de/v1/public/registry/type/
* */
$webfanApplicationMimetypeFilter = array(
'mime' => function($str){
return true;
},
'type' => function($str){
@wehowski
wehowski / gist:b4fcace9706228949d8f6ae2a53fb5bb
Created April 8, 2016 01:08
whenEver.when-then-do-with-me-or.js
/*
* from µ.Flow
* http://api.webfan.de/api-d/4/js-api/library.js
*/
this.whenEver=function(condition, callback, args, delay){
if(('function'===typeof condition && true === condition())
|| (true === (condition))
){
<script type="text/javascript">
var util = require('util');
var opts = {
showHidden : true,
depth : 4
};
console.on('*', function(type, data){
var color = 'black';
function compileTemplateUrl(directives, $compileNode, tAttrs,
$rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
var linkQueue = [],
afterTemplateNodeLinkFn,
afterTemplateChildLinkFn,
beforeTemplateCompileNode = $compileNode[0],
origAsyncDirective = directives.shift(),
derivedSyncDirective = inherit(origAsyncDirective, {
templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
}),
@wehowski
wehowski / MimeStub.php
Last active August 30, 2017 11:19
MimeStub forked from https://github.com/Riverline/multipart-parser -> "self executing" php scripts
<?php
/**
* Copyright (c) 2017, Till Wehowski
* 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
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
<?php
// ----- GET:
$_SESSION[__DIR__.'::spamschutz'] = mt_rand(10, 99999999);
$_SESSION[__DIR__.'::spamschutz_key'] =mt_rand(10, 99999999);
echo '<input type="hidden" name="check_'.$_SESSION[__DIR__.'::spamschutz_key'] .'" value="'.sha1($_SESSION[__DIR__.'::spamschutz'] ).'" />';
// ----- POST:
<?php
define('weB36Notation_Latin1_clean_finaloutput', "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
//show:
if(substr($row['WEID'], 0, 18) == '1-3-6-1-4-1-SZ5-8-' ){
$row['WEID'] = substr($row['WEID'], 18, strlen($row['WEID'])-1);
$row['WEID'] = 'weid:'.$row['WEID'];
}
@wehowski
wehowski / foldersize.php
Created June 14, 2019 06:57
php get directory size
<?php
function foldersize($path) {
// if (is_file($path))
$total_size = 0;
$files = scandir($path);
$cleanPath = rtrim($path, '/'). '/';
foreach($files as $t) {
if ($t<>"." && $t<>"..") {
$currentFile = $cleanPath . $t;
@wehowski
wehowski / Context.php
Created August 4, 2019 20:04
Template processing, braces and dot.notation {{$scope.var}}
<?php
namespace frdl;
/*
https://webfan.de/install/?salt={{salt}}&source=\frdl\Context.php
*/
class Context
{