Skip to content

Instantly share code, notes, and snippets.

@RobinHerbots
RobinHerbots / index.html
Created June 14, 2024 15:16 — forked from JustinK/index.html
MapMyRun API Demo
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<!-- This is where we are going to put the graph -->
@RobinHerbots
RobinHerbots / index.html
Created June 14, 2024 15:16 — forked from JustinK/index.html
MapMyRun API Demo
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<!-- This is where we are going to put the graph -->
@RobinHerbots
RobinHerbots / OpenType.ts
Created September 11, 2023 18:37 — forked from smhanov/OpenType.ts
Here is my implementation of a TrueType font reader in Typescript. You can read a font directly from an ArrayBuffer, and then call drawText() to draw it. See my article http://stevehanov.ca/blog/index.php?id=143. The second file, OpenType.ts is the same thing but it handles more TrueType files. It is also more coplex
// To see this run, you first stub out these imports. Then put the file in a Uint8Array.
// let slice = new Slice(array);
// let font = new OTFFont(slice);
// Then you can call methods like font.drawText(canvasContext, )
//
//
import { ICanvasContext } from "./ICanvasContext"
import { log as Log } from "./log"
const log = Log.create("OPENTYPE");
@RobinHerbots
RobinHerbots / configure.md
Created December 29, 2022 07:41 — forked from jherax/configure.md
VS Code: Debugging with Jest

VS Code: Debugging Jest

Sometimes, debugging with console.log is not enough to find out what is happening in the code, as console.log prints only plain objects but neither functions nor objects with circular references. Besides, it's possible you may need to know the context and flow of the code.

Read more about debugging with VS Code in VS Code: Debugging.

@RobinHerbots
RobinHerbots / renderWithRouterMatchExample.js
Created December 6, 2022 07:39 — forked from adamjarling/renderWithRouterMatchExample.js
Example of a Testing Library renderWith helper function to include React Router match object in tests
// Component example
// ContentWrapper.jsx
import React from "react";
import Main from "./Main";
import { withRouter } from "react-router-dom";
const ContentWrapper = ({ children, match }) => (
<Main>
<p>Match id: {match.params.id}</p>
{children}
@RobinHerbots
RobinHerbots / event-offset-polyfill.js
Created October 2, 2021 18:18 — forked from ripter/event-offset-polyfill.js
Adds MouseEvent .offsetX and .offsetY to Firefox
// polyfill for event.offsetX/offsetY
// Firefox is the only browser that doesn't support it (IE has since 4)
(function() {
var evt = document.createEvent('MouseEvent');
if (evt.offsetX === void 0) {
Object.defineProperties(MouseEvent.prototype, {
'offsetX': {
get: function() {
return this.layerX - this.target.offsetLeft;
}
@RobinHerbots
RobinHerbots / gist:5eda12d1921c9c8bcd7737aec327ec9a
Created June 21, 2019 14:11 — forked from pmhsfelix/gist:4151369
Generating and validating JWT tokens using JWTSecurityTokenHandler
[Fact]
public void First()
{
var tokenHandler = new JWTSecurityTokenHandler();
var symmetricKey = GetRandomBytes(256/8);
var now = DateTime.UtcNow;
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new Claim[]
@RobinHerbots
RobinHerbots / uriSchemeWithHyperlinkFallback.js
Created December 6, 2018 15:43 — forked from ChaseFlorell/uriSchemeWithHyperlinkFallback.js
Ever want to launch a mobile app from within the browser, but ensure that the browser still redirects the user to the link if the app isn't installed? This took some fiddling around, but when the "ah ha" moment hit, the solution is really quite simple.
// tries to execute the uri:scheme
function uriSchemeWithHyperlinkFallback(uri, href) {
// set up a timer and start it
var start = new Date().getTime(),
end,
elapsed;
// attempt to redirect to the uri:scheme
// the lovely thing about javascript is that it's single threadded.
// if this WORKS, it'll stutter for a split second, causing the timer to be off
// tries to execute the uri:scheme
function uriSchemeWithHyperlinkFallback(uri, href) {
if(!window.open(uri)){
window.location = href;
}
}
@RobinHerbots
RobinHerbots / index.ejs
Created February 23, 2017 12:24 — forked from ksrb/index.ejs
jquery.inputmask webpack configuration and package.json
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<input id="float"/>
</body>
</html>