Skip to content

Instantly share code, notes, and snippets.

data:text/html, <body><canvas id="dyDraw">HTML5 Canvas</canvas></body><script>function $(id){return document.getElementById(id);} $('dyDraw').width=document.body.clientWidth;$('dyDraw').height=document.body.clientHeight;if(window.addEventListener){window.addEventListener('load',function(){var canvas,canvastext;var hua=false;function dyDrawing(){canvas=$('dyDraw');canvastext=canvas.getContext('2d');canvas.addEventListener('mousedown',canvasMouse,false);canvas.addEventListener('mousemove',canvasMouse,false);window.addEventListener('mouseup',canvasMouse,false);} function canvasMouse(dy){var x,y;if(dy.layerX||dy.layerX==0){x=dy.layerX;y=dy.layerY;}else if(dy.offsetX||dy.offsetX==0){x=dy.offsetX;y=dy.offsetY;} x-=dyDraw.offsetLeft;y-=dyDraw.offsetTop;if(dy.type=='mousedown'){hua=false;canvastext.beginPath();canvastext.moveTo(x,y);hua=true;}else if(dy.type=='mousemove'){if(hua){canvastext.strokeStyle="rgb(255,0,0)";canvastext.lineWidth=9;canvastext.lineTo(x,y);canvastext.stroke();}}else if(dy.type=='mouseup'){hua=f
@pnairn
pnairn / modsecurity(basic-example).conf
Created July 8, 2016 00:59
An example modsecurity.conf file for the Stack Overflow question:
# -- Rule engine initialization ----------------------------------------------
# Enable ModSecurity, attaching it to every transaction. Use detection
# only to start with, because that minimises the chances of post-installation
# disruption.
#
#SecRuleEngine DetectionOnly
SecRuleEngine On
@pnairn
pnairn / _animate.css
Last active December 26, 2015 12:09
Simple SCSS mixin to produce the CSS output for animating HTML elements.
@mixin animation ($delay, $duration, $mode, $animation) {
-webkit-animation: $animation $delay $mode $duration both;
-moz-animation: $animation $delay $mode $duration both;
-o-animation: $animation $delay $mode $duration both;
-ms-animation: $animation $delay $mode $duration both;
animation: $animation $delay $mode $duration both;
}
@mixin keyframe ($animation_name) {
@-webkit-keyframes $animation_name {