Skip to content

Instantly share code, notes, and snippets.

View rsiddle's full-sized avatar

Ryan Siddle rsiddle

View GitHub Profile
<!-- https://example.com/sitemaps.xml -->
<sitemapindex>
<sitemap>
<loc>https://example.com/sitemaps/category-electronics.xml</loc>
</sitemap>
<sitemap>
<loc>https://example.com/sitemaps/category-home-entertainment.xml</loc>
</sitemap>
<sitemap>
<loc>https://example.com/sitemaps/category-furniture.xml</loc>
@rsiddle
rsiddle / remove-kibana-mac.sh
Created November 17, 2020 13:16
Remove Kibana from macOS
#!/usr/bin/env sh
# Adapted from https://gist.github.com/jkubacki/e2dd904bd648b0bd4554
# checks to see if running
launchctl list | grep kibana
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.kibana.plist
launchctl remove homebrew.mxcl.kibana
require 'benchmark'
Benchmark.bm(7) do |x|
STR = 'l2yanS'
REGEX1 = /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6}$/
REGEX2 = /^(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{6}$/
x.report("Using backslash d:") { 1_000_000.times do
STR =~ REGEX1
end }
x.report("Using 0-9:") { 1_000_000.times do
@rsiddle
rsiddle / claimreview.html
Last active November 8, 2017 11:11
ClaimReview Schema.org Markup Example
<div itemscope="" itemtype="http://schema.org/ClaimReview">
An example paragraph reviewing a claim expressed in another document.
<dl>
<dt>Date published:</dt>
<dd itemprop="datePublished">2014-07-23</dd>
<dt>Review url:</dt>
<dd itemprop="url">http://www.politifact.com/texas/statements/2014/jul/23/rick-perry/rick-perry-claim-about-3000-homicides-illegal-immi/</dd>
<dt>Review by:</dt>
<dd>
<span itemprop="author" itemscope="" itemtype="http://schema.org/Organization">
Network Working Group T. Berners-Lee
Request for Comments: 3986 W3C/MIT
STD: 66 R. Fielding
Updates: 1738 Day Software
@rsiddle
rsiddle / escape_unescape_urls.rb
Created October 5, 2017 12:47
A short script that can escape or unescape a list.
#!/usr/bin/env ruby
require 'cgi'
CGI_METHODS = %w[escape unescape]
USAGE = "usage: #{File.basename(__FILE__)} input output type"
input = ARGV[0]
output = ARGV[1]
type = ARGV[2]
@rsiddle
rsiddle / multi-switch-x-dns-prefetch-control.html
Created September 19, 2017 14:35
Showing how to switch on and off DNS-prefetch for Chrome and Firefox through multiple <meta> tags
<!DOCTYPE html>
<html lang="en">
<head>
...
<meta http-equiv="X-DNS-Prefetch-Control" content="on" />
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
<link rel="dns-prefetch" href="https://ajax.googleapis.com" />
<link rel="dns-prefetch" href="https://cdnjs.cloudflare.com" />
<link rel="dns-prefetch" href="https://www.google-analytics.com" />
...
@rsiddle
rsiddle / x-dns-prefetch-control-on.html
Created September 19, 2017 14:30
Showing how to switch on DNS-prefetch for Chrome and Firefox through a <meta> tag
<head>
<meta http-equiv="X-DNS-Prefetch-Control" content="on" />
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
<link rel="dns-prefetch" href="https://ajax.googleapis.com" />
<link rel="dns-prefetch" href="https://cdnjs.cloudflare.com" />
<link rel="dns-prefetch" href="https://www.google-analytics.com" />
</head>
@rsiddle
rsiddle / d-2.rb
Last active June 9, 2017 12:43
d-2.rb
def d(a, b, &block)
va = a.is_a?(Array) ? 1 : 0
vb = b.is_a?(Array) ? 2 : 0
v = va + vb
case v
when 0
block.call(a, b)
when 1
a.map do |e|
d(e, b, &block)