This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE map.cluster_locations ( | |
| id serial PRIMARY KEY, | |
| geom Geometry | |
| ); | |
| INSERT INTO map.cluster_locations (geom) | |
| SELECT (ST_Dump(ST_GeneratePoints(geom, 100000, 1996))).geom as geom | |
| FROM ( | |
| SELECT ST_Union(geom) as geom FROM map.singapore | |
| ) AS s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('dotenv').config() | |
| const express = require('express'); | |
| const app = express(); | |
| const { Pool, Client } = require('pg'); | |
| const pool = new Pool({ | |
| user: process.env.DB_USER, | |
| host: process.env.DB_HOST, | |
| database: process.env.DB_DBNAME, | |
| password: process.env.DB_PASS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function timer() { | |
| layer.setParams({'r': Math.random()}, false); | |
| setTimeout(timer, 5000); | |
| } | |
| setTimeout(timer, 5000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('leaflet'); | |
| var WMS = require('leaflet.wms'); | |
| window.onload = function() { | |
| // initialize the map on the "map" div with a given center and zoom | |
| var map = L.map('map', { | |
| center: new L.LatLng(1.355, 103.84), | |
| zoom: 13, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE map.assets ( | |
| id SERIAL primary key, | |
| name VARCHAR(50) | |
| ); | |
| CREATE TABLE map.assets_location ( | |
| id SERIAL primary key, | |
| asset_id INTEGER references assets, | |
| last_update TIMESTAMP, | |
| geom geometry(Point, 4326) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| await this._page.evaluateOnNewDocument(() => { | |
| let checkWatchTimeFunc = () => { | |
| let currElem = document.getElementsByClassName('ytp-time-current'); //grab the element showing current play time | |
| let maxElem = document.getElementsByClassName('ytp-time-duration'); //grab the element showing total play time | |
| if ( | |
| currElem.length > 0 && maxElem.length > 0 //check if there are any such element | |
| && currElem[0].innerText === maxElem[0].innerText //compare the value between the 2 elements | |
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require("https"); | |
| const JSONbig = require('json-bigint'); | |
| fs = require('fs') | |
| const req = https.request(`https://content.dropboxapi.com/2/files/upload_session/start`, { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${TOKEN}`, | |
| 'Dropbox-API-Arg': JSON.stringify({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require("https"); | |
| fs = require('fs') | |
| fs.readFile('test.txt', 'utf8', function (err, data) { | |
| const req = https.request('https://content.dropboxapi.com/2/files/upload', { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${TOKEN}`, | |
| 'Dropbox-API-Arg': JSON.stringify({ | |
| 'path': '/Upload/test.txt', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require("https"); | |
| const data = "{\"limit\": 1000}"; | |
| const req = https.request('https://api.dropboxapi.com/2/file_requests/count', { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${TOKEN}`, | |
| }, | |
| }, (res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const multer = require('multer'); | |
| const path = require('path'); | |
| const app = express(); | |
| const port = 8080; | |
| app.use('/', express.static('public')); | |
| var storage = multer.diskStorage({ | |
| destination: function (req, file, cb) { |