Skip to content

Instantly share code, notes, and snippets.

@mleko
mleko / lint.sh
Created April 19, 2017 16:18
PHP lint directory
#!/bin/sh
# ! inverts return code (fails on non-empty grep output)
! find . -type f -name '*.php' -exec php -l {} \; | grep -v "No syntax errors detected"
@mleko
mleko / gray_binary.c
Created April 7, 2017 11:19
Binary to Gray code (and reverse) conversion functions https://en.wikipedia.org/wiki/Gray_code
/**
The MIT License (MIT)
Copyright (c) 2017 Daniel Król
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T
@mleko
mleko / .gitconfig
Last active March 18, 2017 12:18
Git config
[core]
excludesfile = ~/.gitignore
pager = less -x4
[user]
name = Daniel Król
email = daniel@krol.me
[push]
default = simple
[merge]
ff = true
<div style="font-family: monospace;font-size: 16px;text-align: center;width: 190px;color: white;background-color: #c00;transform: rotate(45deg);z-index: 9999; position: fixed; top: 30px; right: -50px;font-weight: bold;padding: 5px;cursor: pointer;opacity: 1;"
onclick="var s=this.style,p='opacity',t=setTimeout,i=function(){if(s[p]<1){s[p]-=-0.05;s.display='block';t(i,10);}else{s[p]=1;}},o=function(){if(s[p]>0){s[p]-=0.05;t(o,10);}else{s[p]=0;s.display='none';t(i,5e+3);}};o();">
<div style="border: 1px white dashed;">DEVELOPMENT</div>
</div>