Skip to content

Instantly share code, notes, and snippets.

@lightjs
lightjs / index.html
Last active March 11, 2018 20:36
SVG resize with non-scaling-stroke value for vector-effect attribute avoiding deformation on path stroke (cross browser)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>SVG resize</title>
<style>
div, svg {
width:100%;
height:100%;
}
@lightjs
lightjs / gist:4604334
Created January 23, 2013 10:50
Turn a json into a full object, with getter / setter for all values and init function for new getter / setter.
var jsonize = function(obj) {
if( typeof obj == 'object' && !(obj[k] instanceof Array) && Object.keys(obj).length > 0 ) {
for( var k in obj ) {
if( obj[k] instanceof Array ) for( var k2 in obj[k] ) obj[k][k2] = jsonize(obj[k][k2]);
else if( typeof obj[k] == 'object' && !(obj[k] instanceof Array) && Object.keys(obj[k]).length > 0 ) jsonize(obj[k]);
obj['_'+k] = obj[k];
obj[k] = (function(n) {
return function(_) {
if(!arguments.length) return obj['_'+n];
obj['_'+n] = _;