Skip to content

Instantly share code, notes, and snippets.

View ca0v's full-sized avatar

Corey Alix ca0v

  • Westfield, VT
View GitHub Profile
@ca0v
ca0v / Kitsuma.gpx
Created July 4, 2021 00:24
Kitsuma.gpx
<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" creator="https://www.mtbproject.com">
<metadata><name>Kitsuma / Heartbreak</name><author><name/><link href="https://www.mtbproject.com/user/7099255/rj-manoni"/></author><copyright author="MTB Project"><year>2019</year></copyright></metadata><trk><name>Kitsuma / Heartbreak</name><link href="https://www.mtbproject.com/trail/7020396/kitsuma-heartbreak"/><trkseg><trkpt lon="-82.218675" lat="35.635807"><ele>492.92</ele><time>2018-10-23T10:59:08-06:00</time></trkpt><trkpt lon="-82.219034" lat="35.635931"><ele>495.13</ele><time>2018-10-23T11:00:08-06:00</time></trkpt><trkpt lon="-82.219869" lat="35.635727"><ele>499.33</ele><time>2018-10-23T11:01:08-06:00</time></trkpt><trkpt lon="-82.220903" lat="35.635398"><ele>502.98</ele><time>2018-10-23T11:02:08-06:00</time></trkpt>
@ca0v
ca0v / App.svelte
Last active September 19, 2020 04:00
Svelte After Several Hours
<script>
const chars = "hello world".split("").map((v, i) => ({ v, i }));
$: src = chars.map((v) => v.v).join("");
function deleteHandler(e) {
switch (e.e.code) {
case "ArrowLeft": {
const targetIndex = (chars.length + e.i - 1) % chars.length;
chars[e.i].v = chars[targetIndex].v;
chars[targetIndex].v = e.v;
classDiagram
class baseContract
class instance1
class instance2
class instance3
class API
baseContract <|.. base
base <|-- instance1
base &lt;|-- instance2
@ca0v
ca0v / Component.ts
Last active December 23, 2019 20:35
svelte gems
/**
* Defines the component lifecycle-ish? (maybe HtmlTag in dom.ts is a parital implementation?)
* Relates to chunks in Block.ts
*/
interface Fragment {
key: string|null;
first: null;
/* create */ c: () => void;
/* claim */ l: (nodes: any) => void;
/* hydrate */ h: () => void;
@ca0v
ca0v / rust.md
Created November 13, 2018 00:45
rust.md
@ca0v
ca0v / app+myapp.ts
Created September 21, 2018 16:01
tsconfig with paths and include fails
export class MyApp {
execute() {
return true;
}
}
@ca0v
ca0v / ol2-json-utils.ts
Created June 20, 2018 13:55
openlayers2 geojson to geometry
import ol = require("ol2");
export type GeoJsonGeometry = {
type: "point";
coordinates: number[];
} | {
type: "multipoint";
coordinates: number[][];
} | {
type: "linestring";
@ca0v
ca0v / Convert WKT to Json for ESRI JSAPI
Created June 15, 2018 18:49 — forked from mitch-cohen/Convert WKT to Json for ESRI JSAPI
This function will convert the Well Known Text to JSON for ESRI Geometry creation. See example at http://jsfiddle.net/mac1175/6hcax/
// from https://gist.github.com/mitch-cohen/9547514
export function toJson(WKTstr: string) {
// trim leading "(" and trailing ")" characters
function unbracket(str: string) {
let left = str.indexOf("(") + 1;
let right = str.lastIndexOf(")");
if (right < str.length - 1) right = str.length;
return str.substring(left, right);
}
@ca0v
ca0v / ResolutionWatcher.ts
Created May 10, 2018 14:56
ol.control.Resolution: reports the resolution as number of meters in 96 pixels (unsure how to get the actual dpi)
class ResolutionWatcher extends ol.control.Control {
private element: HTMLElement;
constructor(options?: olx.control.ControlOptions & {
className?: string;
render?: Function;
}) {
options = _.defaults(options || {}, {
element: document.createElement("div"),
import dojoDeclare = require("dojo/_base/declare");
import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer");
import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer");
import Stateful = require("dojo/Stateful");
import lang = require("dojo/_base/lang");
import infor = require("../../../gis.map.ext");
import { MapExtent } from "../../../models";
import * as Models from "../../../models";
import Extent = require("esri/geometry/Extent");
import TileInfo = require("esri/layers/TileInfo");