Maze generator

function maze(x,y) {
var n=x*y-1;
if (n<0) {alert("illegal maze dimensions");return;}
var horiz =[]; for (var j= 0; j0 && j0 && (j != here[0]+1 || k != here[1]+1));
}
while (00 && m.verti[j/2-1][Math.floor(k/4)])
line[k]= ' ';
else
line[k]= '-';
else
for (var k=0; k0 && m.horiz[(j-1)/2][k/4-1])
line[k]= ' ';
else
line[k]= '|';
else
line[k]= ' ';
if (0 == j) line[1]= line[2]= line[3]= ' ';
if (m.x*2-1 == j) line[4*m.y]= ' ';
text.push(line.join('')+'\r\n');
}
return text.join('');
}

Tags: 

show column names containing %..%

show column names met naam %rekening%

SELECT table_name, column_name
FROM information_schema.columns
WHERE column_name LIKE '%rekening%'
LIMIT 0 , 30

Tags: 

window size width height

var w = window.innerWidth;
var h = window.innerHeight;

Tags: 

localstorage

local storageif(typeof(Storage)!=="undefined")
{
// Code for localStorage/sessionStorage.
}
else
{
// Sorry! No Web Storage support..
}

random int between

Math.floor((Math.random() * 100) + 1);

Tags: 

set get value from input field

getvar bla = $('#txt_name').val();

set$('#txt_name').val('bla’);

Tags: 

html 5 input minimum length text

<input pattern=".{3,}" required title="3 characters minimum”]]>

Tags: 

click jquery add target

click

html

Click here

js

$( "#target" ).click(function() {

alert( "Handler for .click() called." );

});

Tags: 

on document load jquery

$( document ).ready(function() {

console.log( "ready!" );

});

Tags: 

on mouse down register x y

var clicking = false;

$('.selector').mousedown(function(){
clicking = true;
$('.clickstatus').text('mousedown');
});

$(document).mouseup(function(){
clicking = false;
$('.clickstatus').text('mouseup');
$('.movestatus').text('click released, no more move event');
})

$('.selector').mousemove(function(){
if(clicking == false) return;

// Mouse click + moving logic here
$('.movestatus').text('mouse moving');
});

Tags: 

Pages

Subscribe to hjsnips RSS