View leaflet-fullscreen-control.js
This file contains 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
/** | |
* A Leaflet Control, to request fullscreen for map (no CSS, no image) | |
* | |
* @example new FullscreenControl({ position: "topleft" }).addTo(map); | |
*/ | |
export class FullscreenControl extends L.Control { | |
onAdd() { | |
const container = L.DomUtil.create("div", " leaflet-bar"); | |
const link = L.DomUtil.create("a", undefined, container); | |
link.innerHTML = "⛶"; |
View leaflet-collapsable-layer-control.js
This file contains 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
/** | |
* A Leaflet Layer Control, which may be expanded by default, but may be collapsed using a button. | |
* | |
* @example new CollapsableLayerControl(layers, {}, { collapsed: false }) | |
*/ | |
export class CollapsableLayerControl extends L.Control.Layers { | |
onAdd(map) { | |
L.Control.Layers.prototype.onAdd.call(this, map); | |
const div = document.createElement("div"); | |
div.style.textAlign = "right"; |
View Application.java
This file contains 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
package root; | |
import root.resources.HelloResource; | |
import org.eclipse.jetty.server.Server; | |
import org.eclipse.jetty.servlet.ServletContextHandler; | |
import org.eclipse.jetty.servlet.ServletHolder; | |
import org.glassfish.jersey.server.ResourceConfig; | |
import org.glassfish.jersey.servlet.ServletContainer; | |
public class Application { |
View parse_timedelta.py
This file contains 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
from datetime import timedelta | |
import re | |
import unittest | |
def parse_timedelta(delta: str) -> timedelta: | |
"""Parses the given string as ISO 8601 timedelta""" | |
# https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence) | |
match = re.compile( | |
r"(?P<sign>[-+]?)P" |
View HTTPS.java
This file contains 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
import javax.net.ssl.SSLContext; | |
import javax.net.ssl.TrustManager; | |
import javax.net.ssl.X509TrustManager; | |
import java.security.KeyManagementException; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import java.security.cert.CertificateException; | |
import java.security.cert.X509Certificate; | |
import java.util.HexFormat; |
View JwtTest.java
This file contains 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
import com.auth0.jwt.JWT; | |
import com.auth0.jwt.algorithms.Algorithm; | |
import org.bouncycastle.util.io.pem.PemReader; | |
import org.junit.Test; | |
import java.io.BufferedReader; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.security.KeyFactory; | |
import java.security.interfaces.RSAPrivateKey; |
View git.sh
This file contains 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
git checkout --orphan new-framework | |
# completely rewrite your application in new framework | |
git merge --strategy=ours --allow-unrelated-histories master | |
git commit-tree -p HEAD^2 -p HEAD^1 -m "Merge branch 'new-framework'" "HEAD^{tree}" | |
git reset --hard $OUTPUT_FROM_PREVIOUS_COMMAND | |
git checkout master | |
git merge --ff-only new-framework |
View OSMSchema.xsd
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Using optional BOM (0xEF 0xBB 0xBF) --> | |
<!-- From http://forum.openstreetmap.org/viewtopic.php?id=7186 --> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
targetNamespace="http://openstreetmap.org/osm/0.6" | |
xmlns="http://openstreetmap.org/osm/0.6"> | |
<xs:element name="osm"> | |
<xs:complexType> | |
<xs:sequence> |
View m4a2ogg
This file contains 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
#!/bin/bash | |
# Author: Simon Legner <Simon.Legner@gmail.com> | |
convert () { | |
in="$1" | |
out="${in%.m4a}.ogg" | |
ffmpeg -i "$in" \ | |
-acodec libvorbis -aq 4 -vn -ac 2 \ | |
-map_metadata 0 \ | |
"$out" |
View index.html
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<link | |
rel="stylesheet" | |
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" | |
/> | |
</head> |
NewerOlder