Skip to content

Instantly share code, notes, and snippets.

Martijn van der Ven Zegnat

Block or report user

Report or block Zegnat

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
View hreflang-flags.css
/* Show flags on links to a different language than your entry: */
.h-entry:not([lang|="nl"]) a[hreflang|="nl"]::after { content: ' 🇳🇱'; }
.h-entry:not([lang|="en"]) a[hreflang|="en"]::after { content: ' 🇬🇧'; }
/* You can overwrite on a regional basis: */
.h-entry:not([lang|="en"]) a[hreflang="en-US"]::after { content: ' 🇺🇸'; }
/* Then remove flags for your default language: */
.h-entry:not([lang]) a[hreflang|="en"]::after { content: none; }
View test.txt
Restults from https://kartikprabhu.com/static/demo/selection-encodeURI.html on Windows 10 Pro.
---
Internet Explorer 11
Version: 11.576.14373.0
non-breaking space? Let's try UTF non-breaking space in decimal or non-breaking space in hex?
non-breaking%20space?%20Let's%20try%20UTF%20non-breaking%20space%20in%20decimal%20or%20non-breaking%20space%20in%20hex?
@Zegnat
Zegnat / QBool.php
Created Aug 22, 2016
For when you need a quantum boolean that is true only some percent of the time.
View QBool.php
<?php
namespace Zegnat;
class QBool
{
public $chance;
public $scale;
public function __construct($chance)
View bind-only-on-widget.patch
@@ -70,16 +70,16 @@
});
// enter key submits form
- $items.on('enterKeyDown', function onEnterKeyDown(e) {
+ $widget.on('enterKeyDown', function onEnterKeyDown(e) {
$form.submit();
});
// spacebar triggers 'check' event
View heroquizz.js
$('.my_answers').each(function(){if(/(\d+), \d+, \1\)/.test(this.getAttribute('onclick')))this.style.backgroundColor='green'});
@Zegnat
Zegnat / kendo-filter.json
Last active Jul 3, 2016
JSON Schema for validating JSON representations of Kendo filters.
View kendo-filter.json
{
"$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
"definitions": {
"filter": {
"oneOf": [
{
"type": "object",
"properties": {
"field": {
"type": "string",
View index.php
<?php
/**
* A minimal PhotoBackup API endpoint developed in PHP.
*
* @version 1.0.0
* @author Martijn van der Ven <martijn@zegnat.net>
* @copyright 2015 Martijn van der Ven
* @license http://opensource.org/licenses/MIT The MIT License
*/
@Zegnat
Zegnat / .bash_minidlna
Last active Apr 24, 2016
These are the aliases I have configured to control my MiniDLNA set-up.
View .bash_minidlna
# Running DLNA server via `minidlnad`
alias dlna_remove_log="if [ -f ~/.config/minidlna/minidlna.log ];then rm ~/.config/minidlna/minidlna.log;fi"
alias dlna_stop="if [ -f ~/.config/minidlna/minidlna.pid ];then cat ~/.config/minidlna/minidlna.pid | xargs kill;fi"
alias dlna_init="minidlnad -f ~/.config/minidlna/minidlna.conf -P ~/.config/minidlna/minidlna.pid"
alias dlna_start="dlna_stop;dlna_remove_log;dlna_init"
alias dlna_rescan="dlna_stop;dlna_remove_log;dlna_init -R"
View Class.php
/**
* Send JSON encoded data to the browser and end all further processing.
* @method endWithJson
* @param array $data A data array.
* @throws InvalidArgumentException
* @return void
*/
private function endWithJson($data)
{
if (!is_array($data)) {
@Zegnat
Zegnat / zegnat.sugar.js
Created Jan 23, 2014
Some extensions to Sugar.
View zegnat.sugar.js
Number.extend({
'sign': function() {
// http://stackoverflow.com/a/21294663/3225372
return typeof this === 'number' ? this ? this < 0 ? -1 : 1 : this === this ? this : NaN : NaN;
},
'isPositive': function() {
return this.sign() === 1;
},
'isNegative': function() {
return this.sign() === -1;
You can’t perform that action at this time.