Skip to content

Instantly share code, notes, and snippets.

View sabman's full-sized avatar
😀
Building, Shiping, Sharing!

Shoaib Burq sabman

😀
Building, Shiping, Sharing!
View GitHub Profile
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
@sabman
sabman / Issues.md
Created March 19, 2020 16:09 — forked from rclark/Issues.md
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
@sabman
sabman / index.html
Last active October 19, 2019 07:47 — forked from ramiroaznar/index.html
leaflet.draw + CARTO
<!DOCTYPE html>
<html>
<head>
<title>leaflet.draw + CARTO</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="https://cartodb.com/assets/favicon.ico" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet-src.js"></script>
@sabman
sabman / .rubocop.yml
Created March 2, 2019 22:54 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@sabman
sabman / index.html
Last active May 11, 2018 12:17 — forked from stevage/index.html
Medieval Melbourne
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@sabman
sabman / index.html
Created April 13, 2018 11:16 — forked from vaertsen/index.html
Choropleth map with time range slider [CARTO]
<!doctype html>
<head>
<title>Choropleth map with time range slider</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://www.w3schools.com/lib/w3data.js"></script>
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css">
@sabman
sabman / Staging&ProductionUsingGit.md
Last active April 9, 2018 13:31 — forked from mediabeastnz/Staging&ProductionUsingGit
Staging and Production Server using Git.

If you are running a large website where you will need to test new features on a seperate url before pushing them live then the following instructions are for you ;)

For this example imagine your url is apple.com and you want a development/staging site on a subdomain which is dev.apple.com

Setup

  1. First thing you'll want to do is go ahead and create your website in plesk and add the subdomain dev.apple.com at the same time.
  2. ssh into the server e.g. $ ssh username@ipaddress
  3. Once logged in cd into the private directory (this will be where all git repos are stored) e.g. $ cd ~/private
  4. Create the main repo e.g. $ git init --bare apple.git
@sabman
sabman / README.md
Created January 9, 2018 06:31 — forked from rochoa/README.md
[CARTO] MVT service + Mapbox GL

CartoDB's MVT service + Mapbox GL

Check index.html for some examples. These use a beta feature of CartoDB's Maps API: fixed URLs. So there is no need to use cartodb.js and tiles can be consumed using a named map name.

cartodb.js example

Check cartodb.js.html to see the integration with cartodb.js and in particular with cartodb.core.js.

Mapbox GL resources

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>carto-mapboxgl-demo</title>
<link href='https://api.mapbox.com/mapbox-gl-js/v0.26.0/mapbox-gl.css' rel='stylesheet' />
<style>
body {
@sabman
sabman / README.md
Created June 28, 2017 04:05 — forked from jsanz/README.md
CartoDB.js examples: add sublayers

This example shows how to create a Leaflet map with a basemap and an empty CartoDB.js layer. Once the layer is created a function is attached the event of the layers selector checkboxes so on any state change, the sublayers are removed and recreated according to the user selection.