Skip to content

Instantly share code, notes, and snippets.

@PatrickKing
PatrickKing / iana_friendly_timezone_mapping.json
Last active February 11, 2022 22:58
A simple mapping of IANA time zone names to human friendly long and short names.
{
"Africa/Abidjan": {
"long": "Greenwich Mean Time",
"short": "GMT"
},
"Africa/Accra": {
"long": "Greenwich Mean Time",
"short": "GMT"
},
"Africa/Addis_Ababa": {
@PatrickKing
PatrickKing / failure_case.xml
Created January 17, 2017 02:11
ETW traces of a load problem with IIS-Node, with successful (3 concurrent requests) and failed (4 concurrent requests) cases.
<Events>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Guid="{9e814aad-3204-11d2-9a82-006008a86939}" />
<EventID>0</EventID>
<Version>2</Version>
<Level>0</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x0</Keywords>
@PatrickKing
PatrickKing / setAttributeNS.js
Last active October 13, 2016 00:00
Behaviour of setAttributeNS in jsdom
var jsdom = require("jsdom");
var html = '<html><svg "xmlns=http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100"></svg></html>';
jsdom.env({
features: {
QuerySelector: true
},
html: html,
@PatrickKing
PatrickKing / wheel_inertia.html
Created July 4, 2016 20:27
Mousewheel/Touchpad inertia
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
div {
height: 90%;
width: 90%;
@PatrickKing
PatrickKing / Default (Windows).sublime-keymap
Last active May 3, 2016 16:45
My custom slightly OSX-like keybindings for Sublime Text on Windows.
[
{ "keys": ["ctrl+up"], "command": "swap_line_up"},
{ "keys": ["ctrl+down"], "command": "swap_line_down"},
{ "keys": ["ctrl+d"], "command": "duplicate_line"},
{ "keys": ["ctrl+y"], "command": "run_macro_file", "args": {"file": "Packages/User/Delete Line.sublime-macro"} },
{ "keys": ["ctrl+alt+right"], "command": "next_view" },
{ "keys": ["ctrl+alt+left"], "command": "prev_view" },
{ "keys": ["ctrl+g"], "command": "find_next" },
@PatrickKing
PatrickKing / esri-leaflet-renderers-race-condition.html
Created January 27, 2016 20:53
Race condition in esri-leaflet-renderers (esri-leaflet 2.0 + Leaflet 1.0)
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8"> </meta>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
class GameOver < RTanque::Bot::Brain
NAME = 'Honkeytank Blues'
include RTanque::Bot::BrainHelper
require 'pry'
def setup
@once = true
@PatrickKing
PatrickKing / raphael_set_getBBox.js
Created July 27, 2014 00:33
A patch to Raphael to fix handling of empty sets within a set.
Raphael.st.getBBox = function () {
var x = [],
y = [],
x2 = [],
y2 = [];
for (var i = this.items.length; i--;) if (!this.items[i].removed) {
var box = this.items[i].getBBox();
// For lack of a better return value, empty sets return 'infinite' bounding boxes
// But we shouldn't contaminate their parent bounds with this
@PatrickKing
PatrickKing / gist:fbaed82d7e548f1aeb57
Created July 9, 2014 02:03
Dance the Tankgo (RTanque Tank)
class GameOver < RTanque::Bot::Brain
NAME = 'DanceTheTankgo'
include RTanque::Bot::BrainHelper
require 'pry'
def tick!
## main logic goes here
# use self.sensors to detect things