Skip to content

Instantly share code, notes, and snippets.

Gagan Bansal gagan-bansal

Block or report user

Report or block gagan-bansal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ex1.bas
PRINT "Enter the password"
INPUT WORD$
IF WORD$ = "SECRET" THEN
PRINT "permission granted"
ELSE
PRINT "permission denied": GOTO goend
END IF
PRINT "what should I call you"
INPUT name
View README.md

my scripts

some scripts for various work

@gagan-bansal
gagan-bansal / calculate-google-maps-resolutions.js
Created Jan 20, 2015
Calculate google maps (or web mercator projection) zoom level resolutions.
View calculate-google-maps-resolutions.js
var extent = {
left: -20037508.342789244,
right: 20037508.342789244,
bottom: -20037508.342789244,
top: 20037508.342789244
};
var size = 256; // map tile size
var resolutions = [];
for (var i=0; i< 24; i++) {
resolutions.push( (extent.right - extent.left) / (256 * Math.pow(2,i)) );
@gagan-bansal
gagan-bansal / svg2geojson
Created Nov 24, 2014
svg to geojson approach
View svg2geojson
// svg file detail
var width = 400;
var height = 400;
// svg file spatial extent, you should know these values for your file
var extent = {left: -180, bottom: 90, right: 180, top: 90};
var x_res = (extent.left - extent.right) / width;
var y_res = (extent.left - extent.right) / height;
// x_res and y_res should be same
@gagan-bansal
gagan-bansal / main.js
Created Sep 9, 2013
express with browserify-middleware main.js
View main.js
window.OpenLayers = require('./OpenLayers.js');
window.init = function() {
var osm = new OpenLayers.Layer.OSM();
osm.wrapDateLine = false;
var map = new OpenLayers.Map("map",{projection:'EPSG:900913',numZoomLevels:18});
map.addLayers([osm]);
map.setCenter(new OpenLayers.LonLat(8126483.8753499,2162623.286343),15);
console.log('init function called');
};
@gagan-bansal
gagan-bansal / index.html
Created Sep 9, 2013
express with browserify-middleware index.html
View index.html
<html>
<head>
<script type="text/javascript" src="/js/main.js"></script>
<style>
#map {
width:600px;
height:400px;
}
</style>
</head>
@gagan-bansal
gagan-bansal / app.js
Created Sep 9, 2013
sample express with browserify-middleware app.js
View app.js
var browserify = require('browserify-middleware');
var express = require('express');
var app = express();
browserify.settings.development('basedir', __dirname);
app.use('/js',browserify('./client'));
app.get('/js/main.js', browserify('./client/main.js',{
external: ['OpenLayers'],
detectGlobals: false
}));
You can’t perform that action at this time.