This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.{Inet4Address, Inet6Address, InetAddress} | |
import scala.util.Try | |
sealed trait IPAddressException { | |
self: Throwable => val message: String | |
} | |
case class IPAddressParseException(message: String) extends Exception(message) with IPAddressException | |
trait IPAddress { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
// | |
// A Node.js port of this original Gist: https://gist.github.com/danielfaust/998441 | |
// To find hosts on the network: nmap -Pn -p55000 192.168.12.1/24 | |
// | |
// Note: This is for Samsung TVs circa 2012-2015 that use a service running on port 55000 | |
// Samsung TV's circa 2016 and later use a WebSocket service on port 8001 which is different | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding: 5rem; | |
} | |
.animation { | |
height: 1.25rem; | |
margin: .625rem 0 0; | |
} | |
.animation-dot { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gs \ | |
-dNOPAUSE \ | |
-dQUIET \ | |
-dBATCH \ | |
-dSAFER \ | |
-dPDFSETTINGS=/printer \ | |
-dCompatibilityLevel=1.3 \ | |
-dPDFA=2 \ | |
-dPDFACompatibilityPolicy=1 \ | |
-dSimulateOverprint=true \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/app/preactDomRenderer.js | |
import { h, render } from 'preact'; | |
import undom from 'undom'; | |
const VOID_ELEMENTS = [ | |
'area', | |
'base', | |
'br', | |
'col', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Snippet to encode invalid characters from improperly formatted URIs | |
* | |
* RFC 3986 defines that URIs may contain the following characters: | |
* ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=`.``` | |
*/ | |
import java.net.URLEncoder | |
"""[^A-Za-z0-9-._~:/?#\[\]@!$&'\(\)*+,;=%`]|%[^0-9a-fA-F]{2}]""".r. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getOrdinal(value) { | |
const suffixes = ['th', 'st', 'nd', 'rd']; | |
const normalized = value % 100; | |
return value + (suffixes[(normalized - 20) % 10] || suffixes[normalized] || suffixes[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install emblem2hbs cli | |
npm -g install emblem2hbs | |
# Convert all emblem files to handlebars | |
for f in $(ls -1 {,**/}*.emblem); do; emblem2hbs $f; done; | |
# Optionally delete original emblem files | |
find . -name "*.emblem" -exec rm {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install coffeescript cli | |
npm -g install coffee-script | |
# Convert all coffeescript files to javascript | |
find . -name "*.coffee" -exec coffee --no-header --bare -c {} \; | |
# Optionally delete original coffee files | |
find . -name "*.coffee" -exec rm {} \; |
NewerOlder