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
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.get('/js/main.js', browserify('./client/main.js',{
external: ['OpenLayers'],
detectGlobals: false
gagan-bansal / index.html
Created Sep 9, 2013
express with browserify-middleware index.html
View index.html
<script type="text/javascript" src="/js/main.js"></script>
#map {
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.setCenter(new OpenLayers.LonLat(8126483.8753499,2162623.286343),15);
console.log('init function called');
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 / 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)) );

my scripts

some scripts for various work

View ex1.bas
PRINT "Enter the password"
PRINT "permission granted"
PRINT "permission denied": GOTO goend
PRINT "what should I call you"
INPUT name
You can’t perform that action at this time.