Skip to content

Instantly share code, notes, and snippets.

map.on('click', function(event){
var x1_wgs;
var y1_wgs;
async function ajax(x,y){
const data = $.ajax({
url:'/geocoding/egsa_2_wgs.php?x='+x+'&y='+y,
async:true,
type:'GET',
@graingert
graingert / repl.scala
Created December 20, 2017 17:12 — forked from fedesilva/repl.scala
Voldemort types in scala
f@omoikane:~$ scala
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :load Workshop/mine/scala-misc/voldemort.scala
Loading Workshop/mine/scala-misc/voldemort.scala...
defined module Dungeon
scala> val nemesis = Dungeon curse "fedesilva"
@graingert
graingert / client.py
Created September 3, 2021 08:04
websocket client
#!/usr/bin/env python3
import sys
import asyncio
import json
import websockets
async def hello():
uri = "ws://localhost:8888"
@graingert
graingert / bench.py
Created May 20, 2022 15:52 — forked from ajdavis/bench.py
asyncio getaddrinfo benchmark
# Test BaseEventLoop.getaddrinfo performance, before and after my commit 39c135b
# Try a variety of getaddrinfo parameters and log the duration of 10k calls
import socket
import time
from asyncio import get_event_loop
try:
from asyncio.base_events import _ipaddr_info
except ImportError:
"""Middleware."""
from __future__ import annotations
import logging
import pathlib
from django.conf import settings
from whitenoise.middleware import WhiteNoiseMiddleware # type: ignore[import-untyped]