Skip to content

Instantly share code, notes, and snippets.

View Mmontsheng's full-sized avatar
💻
coding

Mmontsheng Maoto Mmontsheng

💻
coding
View GitHub Profile
@antarikshc
antarikshc / gcp-storage.js
Last active June 26, 2023 17:24
Code sample to upload files in Google Cloud Storage bucket for Node.js
// Install GCP Client library
// npm install --save @google-cloud/storage
// To run the client library, you must first set up authentication by creating a service account
// and setting an environment variable. Ask your DevOps person to provide you with service account key
// For example:
// export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/[FILE_NAME].json"
// Imports the Google Cloud client library
const { Storage } = require('@google-cloud/storage');
@IvanSanchez
IvanSanchez / L.TileLayer.ServiceWorker.js
Created October 30, 2015 14:40
Preview of L.TileLayer.ServiceWorker.js
if ('serviceWorker' in navigator && !this.hasOwnProperty('ServiceWorkerGlobalScope')) {
var ownUrl = new URL(document.currentScript.src);
// Before the worker inits, keep tileserver URLs temporarily here
var oldTileLayerProto = L.extend({}, L.TileLayer.prototype);
L.TileLayer._urlsToWatch = [];
L.TileLayer.prototype.initialize = function(url, options) {