Skip to content

Instantly share code, notes, and snippets.

@jimmywarting
jimmywarting / readme.md
Last active April 30, 2024 21:38
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@jcheng5
jcheng5 / README.md
Last active December 15, 2022 16:01
Using arbitrary Leaflet plugins with Leaflet for R

Using arbitrary Leaflet JS plugins with Leaflet for R

The Leaflet JS mapping library has lots of plugins available. The Leaflet package for R provides direct support for some, but far from all, of these plugins, by providing R functions for invoking the plugins.

If you as an R user find yourself wanting to use a Leaflet plugin that isn't directly supported in the R package, you can use the technique shown here to load the plugin yourself and invoke it using JS code.

@acdha
acdha / simple_cors_server.py
Last active May 3, 2024 22:08
Python 3: serve the current directory as HTTP while setting CORS headers for XHR debugging
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
@timelyportfolio
timelyportfolio / code.R
Last active July 9, 2021 18:52
R | Turf.js with V8
#devtools::install("jeroenooms/V8")
library("V8")
library(pipeR)
ct = new_context("window")
# min.js gives me a call stack size error but non-min works fine
ct$source(
"https://raw.githubusercontent.com/morganherlocker/turf/master/turf.js"
)
# one of the examples from turf API docs
@sinemetu1
sinemetu1 / mergeDeep.js
Created February 3, 2012 21:49
javaScript function that merges two JSON objects with the second object taking precedence in the event of a collision.
function mergeDeep (o1, o2) {
var tempNewObj = o1;
//if o1 is an object - {}
if (o1.length === undefined && typeof o1 !== "number") {
$.each(o2, function(key, value) {
if (o1[key] === undefined) {
tempNewObj[key] = value;
} else {
tempNewObj[key] = mergeDeep(o1[key], o2[key]);