Skip to content

Instantly share code, notes, and snippets.

View matthiasott's full-sized avatar

Matthias Ott matthiasott

View GitHub Profile
@matthiasott
matthiasott / vscode-extensions.sh
Created April 23, 2020 00:08
A bash script to install Visual Studio Code extensions via the CLI
# https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
code --install-extension aaron-bond.better-comments
# https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager
code --install-extension alefragnani.project-manager
# https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client
code --install-extension bmewburn.vscode-intelephense-client
# https://marketplace.visualstudio.com/items?itemName=christian-kohler.npm-intellisense
@matthiasott
matthiasott / checkConnectionSpeed.js
Last active March 12, 2021 07:31
Check the current connection speed with the Resource Timing API
let fastConnection = false;
/**
* Checks the current connection speed by calculating the time it takes to download a resource
* Uses the Resource Timing API: https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API
*/
const checkConnectionSpeed = function(resource) {
// Check performance support
if (window.performance === undefined) {
console.log("! window.performance NOT supported");
@matthiasott
matthiasott / extractUrls.php
Last active August 23, 2020 20:11
Extract valid URLs from a given string
<?php
# Extract valid URLs from a given string
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
# Based on WordPress' _extract_urls function (https://github.com/WordPress/WordPress/blob/master/wp-includes/functions.php),
# but using the regular expression by @diegoperini (https://gist.github.com/dperini/729294) – which is close to the perfect URL validation regex (https://mathiasbynens.be/demo/url-regex)

Keybase proof

I hereby claim:

  • I am matthiasott on github.
  • I am matthiasott (https://keybase.io/matthiasott) on keybase.
  • I have a public key whose fingerprint is A96D F663 082E EAEF 0C22 AD71 D175 59E8 2145 F409

To claim this, I am signing this object: