Skip to content

Instantly share code, notes, and snippets.

View dehart's full-sized avatar

Michael dehart

  • The Netherlands
View GitHub Profile
@dehart
dehart / status.html
Created August 30, 2019 13:47
read PHP-FPM /status using javascript fetch()
<html>
<head>
<title>Status</title>
<style>
body {font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial; color: rgba(0, 0, 0, 0.54);}
p { width: 340px; float:left;}
.Running { background-color: greenyellow;}
label,span { display:inline-block;}
label { width: 340px;}
label > span {width:170px;}
@dehart
dehart / tailc
Last active May 28, 2019 14:01
Log reader
#!/bin/bash
# $ chmod +x tailc
# $ tailc logs/debug.log
file=$1
colors='function color(c,s) { printf("\033[%dm%s\033[0m\n",c,s) }
/[\w\/]+/ {color(35,$0);next}
/----/ {color(31,$0);next}
/(\[.*\])/ {color(32,$0);next}
{print " " $0}'
@dehart
dehart / checkbox.html
Created December 19, 2017 22:44
Toying with currentColor
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
#checkbox {
transition: border-color 90ms 0ms cubic-bezier(0, 0, 0.2, 1), background-color 90ms 0ms cubic-bezier(0, 0, 0.2, 1);
border: 2px solid currentColor;
@dehart
dehart / HtmlCell.php
Created March 12, 2014 14:05
HtmlCell FPDF
<?php
require('fpdf.php');
class PDF extends FPDF {
//variables of html parser
private $B=0;
private $I=0;
private $U=0;
private $HREF='';
@dehart
dehart / wisiwig.html
Created February 4, 2014 16:39
WYSIWYG
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>New Doc</title>
<style>
body {
background:grey;
color: white;
}
function q(expr, con) {
return [].slice.call((con || document).querySelectorAll(expr));
}
@dehart
dehart / replace.php
Created December 18, 2013 10:43
Change config array with regex
<?php
$boolean = true;
$array = <<<'EOT'
[
'db'=>'mydb',
'user'=>'root',
'pass'=>'',
'host'=>'localhost',
@dehart
dehart / div.html
Created December 17, 2013 10:50
Shrinking dialog
<html>
<head>
<title>Center dialog that shrinks!</title>
<style>
body {padding:0;margin:0;}
#floater {float:left; height:50%; margin-bottom:-300px;}
#content {clear:both; height:100%; position:relative; max-height: 600px; max-width: 700px; box-shadow: inset 0 0 10px #000000; margin: 0 auto;}
</style>
</head>
<body>
@dehart
dehart / tree
Created August 14, 2013 15:08
Tree transition
<html>
<head>
<title>Nooooo!</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<style>
li {
position:relative;
}
a.collapsed + ul {
opacity: 0;
@dehart
dehart / Loadonscroll.js
Created June 19, 2013 13:47
Load on scroll
var loading = false;
$(window).scroll(function(){
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
if(loading == false){
loading = true;
$('#loadingbar').css("display","block");
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
$('body').append(loaded);
$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
$('#loadingbar').css("display","none");