Skip to content

Instantly share code, notes, and snippets.

@dhcole
dhcole / holidayCheck.js
Last active July 14, 2023 13:04
A Lambda handler to check whether today is a holiday, built to be used with Amazon Connect
/*
*
* Source: https://www.state.nj.us/nj/about/facts/holidays/
* Convert to JSON using ChatGPT prompt:
* "Convert this table to JSON, converting dates to ISO format (pasted table)"
*
*/
const HOLIDAYS = [
{
holiday: "New Year's Day",
var oldDomain = "businessnj.webflow.io";
var newDomain = "business.nj.gov";
if (location.hostname === oldDomain) {
location.replace("https://" + newDomain + location.pathname + location.search);
}
@dhcole
dhcole / domains.js
Last active August 29, 2015 14:24
Federal agency domains from USA.gov
var _ = require('underscore');
var async = require('async');
var request = require('request');
var domains = [
// Federal non-.gov domains
{
url: 'http://govt-urls.usa.gov/tematres/vocab/services.php?output=json&task=fetchDown&arg=17',
json: true,
},
@dhcole
dhcole / _config.yml
Created June 2, 2015 13:35
Jekyll defaults for collections
defaults:
-
scope:
path: ""
values:
layout: "page"
-
scope:
path: "news"
values:
@dhcole
dhcole / index.html
Last active August 29, 2015 14:18 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
<style type='text/css'>
body {
font-family: 'Helvetica';
letter-spacing:-5px;
require 'open-uri'
module Jekyll_Get
class Generator < Jekyll::Generator
def generate(site)
config = site.config['jekyll_get']
if !config
return
end
if !config.kind_of?(Array)
@dhcole
dhcole / gist:e62d831e009b827fca07
Created September 10, 2014 22:24
List files in a directory by type (audit an archived website)
find . -type f | sed 's/^.*\(\.[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]\).*$/\1/' | sort | uniq -c > ../files.dat
@dhcole
dhcole / profile.md
Last active January 19, 2016 10:07
Profiling the `jekyll new` site
posts seconds time
1 0.824 0:0.824
100 2.644 0:2.644
1000 25.071 0:25.071
5000 186.715 3:6.715
10000 536.904 8:56.904

chart

<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="liquid.js"></script>
</head>
<body>
<div id="content"></div>
@dhcole
dhcole / jsonp.xml
Created June 24, 2013 19:58
Akamai edge-side-include for wrapping a JSON file in a JSONP callback function
<assign:extract-value>
<variable-name>CALLBACK</variable-name>
<location>Query_String</location>
<location-id>callback</location-id>
<location-id-prefix-match>off</location-id-prefix-match>
<separator>=</separator>
<add-prefix>none</add-prefix>
<add-suffix>none</add-suffix>
</assign:extract-value>