Skip to content

Instantly share code, notes, and snippets.

View matylla's full-sized avatar

Przemek Matylla matylla

View GitHub Profile
@matylla
matylla / snippet.js
Created January 16, 2012 10:51 — forked from christopherdebeer/snippet.js
Node.js Express - Mobile detection
app.get('/', function(req, res){
var ua = req.header('user-agent');
if(/mobile/i.test(ua)) {
res.render('mobile.html');
} else {
res.render('desktop.html');
}
});
@matylla
matylla / interval.js
Created February 22, 2012 09:06 — forked from gengkev/interval.js
Accurate Javascript setInterval replacement
function Interval(func,duration){
if(typeof func !== "function") throw new TypeError("Expected function");
else if(typeof duration !== "number") throw new TypeError("Expected number");
this.func = func;
this.duration = duration;
this.baseline = +new Date();
(function(_this){
_this.timer = setTimeout(function(){
@matylla
matylla / iot.md
Created July 19, 2012 12:44 — forked from asciidisco/iot.md
Image optimization tools (losless)

I want your lossless image optimization tool knowlegde:

Note: I´am looking for cmd tools (preferred running on mac/linux/win - but it´s not a must) Online services are welcome as well. If you have a good article, stackoverflow post or smth. else on image optimization (with statistics & stuff), i would appriciate if you could share that, too.

Already suggested:

@matylla
matylla / config-haproxy.sh
Created July 23, 2012 13:33 — forked from jsermeno/config-haproxy.sh
Node.js server and Web Sockets on Amazon EC2 with Express.js and Socket.IO - http://catchvar.com/nodejs-server-and-web-sockets-on-amazon-ec2-w
# HAProxy config
mkdir /etc/haproxy
cat > /etc/haproxy/haproxy.cfg << EOF
global
maxconn 4096
defaults
mode http
@matylla
matylla / GLSL-color.md
Created October 5, 2017 10:09 — forked from patriciogonzalezvivo/GLSL-color.md
GLSL color functions

RGB - YUB

mat3 yuv2rgb = mat3(1.0, 0.0, 1.28033, 1.0, -0.21482, -0.38059, 1.0, 2.12798, 0.0);
mat3 rgb2yuv = mat3(0.2126, 0.7152, 0.0722, -0.09991, -0.33609, 0.43600, 0.615, -0.5586, -0.05639);

RGB - HSV