Skip to content

Instantly share code, notes, and snippets.

View anujsinghwd's full-sized avatar
🏠
Working from home

Anuj Singh anujsinghwd

🏠
Working from home
View GitHub Profile
const axios = require('axios');
const fs = require('fs');
const process = async () => {
const response = await axios.get('https://goo.gl/maps/29XfoqKK5s7UdaSy8');
const expression = /window.APP_INITIALIZATION_STATE=\[\[\[\d+.\d+,(\d+.\d+),(\d+.\d+)/
const [,lat, long] = response.data.match(expression)[0].split('[[[')[1].split(',')
console.log({ lat, long})
return { lat, long};
@anujsinghwd
anujsinghwd / GeoJSON.js
Created December 18, 2021 12:16 — forked from max-mapper/GeoJSON.js
google maps polygon editor
var app = {markers: []};
function serializePolygon(gpoly) {
var gjp = {
"type": "Polygon",
"coordinates": []
};
for (var i = 0; i < gpoly.latLngs.length; i++) {
gjp.coordinates[i] = []
var ring = gpoly.latLngs.getAt(i)
@anujsinghwd
anujsinghwd / geo.js
Created November 10, 2021 12:55 — forked from vkarpov15/geo.js
Example of querying a GeoJSON feature collection in MongoDB
db.test.drop();
db.test.insertOne({
name: 'Denver',
location: {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
@anujsinghwd
anujsinghwd / leaflet-google.js
Created October 23, 2021 18:02 — forked from crofty/leaflet-google.js
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
@anujsinghwd
anujsinghwd / node_nginx_ssl.md
Created October 21, 2021 10:59 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user