Skip to content

Instantly share code, notes, and snippets.

View jsyang's full-sized avatar
🎱
Magic numbers

Jim Yang jsyang

🎱
Magic numbers
View GitHub Profile
#!/bin/bash
# nodereinstall
# credit: http://stackoverflow.com/a/11178106/2083544
# get sudo
sudo -v
# check to see if npm is installed
IS_NPM_MISSING=$(which npm)
if [[ -z $IS_NPM_MISSING ]]; then
@jsyang
jsyang / tinyxhr.js
Last active August 29, 2015 14:13 — forked from cslarson/tinyxhr.js
// tinyxhr by Shimon Doodkin - licanse: public doamin - https://gist.github.com/4706967
//
// tinyxhr("http://site.com/ajaxaction",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data) });
// tinyxhr("http://site.com/ajaxaction",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data) },'POST','value1=1&value2=2');
// tinyxhr("http://site.com/ajaxaction.json",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data); console.log(JSON.parse(data)) },'POST',JSON.stringify({value:1}),'application/javascript');
// cb - a callback function like: function (err,data,XMLHttpRequestObject){ if (err) throw err; }
//
function tinyxhr(url,cb,method,post,contenttype)
{
@jsyang
jsyang / IdleBlur.js
Last active August 29, 2015 14:15 — forked from pachacamac/IdleBlur.js
javascript:(function(){
var delay=10000, intensity=10, timer;
function resetTimer(){clearTimeout(timer); timer = setTimeout(blur, delay);}
function activity(){document.documentElement.setAttribute('style',''); resetTimer();}
function blur(){document.documentElement.setAttribute('style', 'filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'blur\'><feGaussianBlur stdDeviation=\''+intensity+'\' /></filter></svg>#blur");-webkit-filter:blur('+intensity+'px);filter:blur('+intensity+'px);');}
['mousemove', 'keypress', 'scroll'].forEach(function(e){document.addEventListener(e, activity, false);});
resetTimer();
})();void(0);
<html>
<style>
body {
font-family: sans-serif;
font-size: 10px;
}
.scene {
position: absolute;
top: 0;
@jsyang
jsyang / apps.md
Last active September 20, 2016 10:09
CM13 Apps and utils
@jsyang
jsyang / svg-creator-tool.html
Created July 7, 2016 15:19 — forked from pachacamac/svg-creator-tool.html
simple as fuck svg creator
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>SVG Helper Tool</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p>click and drag on the canvas ... you're making a polygon ... <button id="reset">reset</button><button id="undo">undo</button></p>
<canvas id="x" width="500" height="500" style="border: 1px solid black;"></canvas>

Jon is visiting New York City for the first time. He would like to make use of his stay by touring various places around the city. He wonders if there could be any system which helps him to find a most optimal route which covers as many tourist places as possible from his source to his desired destination point.

Luckily, we have Open Street Maps which contatins "tags" on each road describing it. More information about it can be found here, http://wiki.openstreetmap.org/wiki/Elements#Tag.

Now, you as a Software Developer, need to develop a system to solve his problem. Here are the things that will help you,

Using these, when a source and destination points are given, you need to find a route which has a maximum number of tourist places in it.