Skip to content

Instantly share code, notes, and snippets.

@mjumbewu
mjumbewu / 1-hexgrid_illustration.svg
Last active October 27, 2024 07:01
PostGIS function to generate a grid of hexagonal cells in a PostgreSQL database
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mjumbewu
mjumbewu / leaflet-smoothrender.js
Last active October 22, 2024 15:29
A Leaflet renderer that will reproject vector layers at each step of an animated transition. This renderer is best when you have relatively few features.
const SmoothRenderer = L.SVG.extend({
// Override the default _onZoom function, which simply scales the lower
// resolution shapes. Instead, we want to reproject the shapes at each new
// zoom level, as is done by default when zooming ends.
_onZoom: function () {
this._onZoomEnd();
this._update();
}
});
@mjumbewu
mjumbewu / django urlpattern list .py
Last active February 8, 2024 20:40 — forked from ashishtajane/django urlpattern list .py
Get all URL patterns in django
# Open django shell and do following.
from django.urls import get_resolver
def show_urls(urllist, depth=0):
for entry in urllist:
print(' ' * depth, entry.pattern)
if hasattr(entry, 'url_patterns'):
show_urls(entry.url_patterns, depth + 1)
@mjumbewu
mjumbewu / gist:4667649
Last active February 5, 2024 17:59
Synaptic TouchPad properties on a Dell XPS 13
mjumbewu@mjumbewu-xps ~
$ uname -a
Linux mjumbewu-xps 3.5.0-22-generic #34+kamal11~DellXPS-Ubuntu SMP Fri Jan 11 09:12:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
mjumbewu@mjumbewu-xps ~
$ xinput list-props 12
Device 'CyPS/2 Cypress Trackpad':
Device Enabled (132): 1
Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (255): 1
<html>
<head>
<style>
#checker-board {
width: 400px;
height: 400px;
background-color: #ffbc00;
border: 10px solid rgba(0,0,0,0.65);
border-radius: 10px;
position: relative;
@mjumbewu
mjumbewu / timeout.js
Created August 19, 2022 14:48
A simple JavaScript function to allow using setTimeout with async/await.
function timeout(duration) {
return new Promise((resolve) => {
setTimeout(resolve, duration);
});
}
/*
Example:
async function dostuff() {
<html>
<head>
<style>
html,body {
padding: 0;
margin: 0;
}
#left-paddle {
background-color: green;
# =============================================================================
# ON THE SERVER...
# Check the amount of disk space available on root (/) partition
df -h
# See where space is being consumed
cd /; sudo du -h --max-depth=1
# In this case, most was in /emergence; further digging and du-ing
@mjumbewu
mjumbewu / nginx.conf
Created June 2, 2016 01:27
Simple SSL-enabled nginx config to serve static files
server {
listen 80;
return 301 https://\$host\$request_uri;
}
server {
listen 443 ssl;
ssl_certificate [PATH_TO_SSL_CERT];
ssl_certificate_key [PATH_TO_SSL_CERT_KEY];
@mjumbewu
mjumbewu / xpath.md
Last active February 24, 2020 01:16
SEPTA Key Trip Grid Parser