Skip to content

Instantly share code, notes, and snippets.

View greggnakamura's full-sized avatar

Gregg Nakamura greggnakamura

View GitHub Profile
@greggnakamura
greggnakamura / access-control-origin.xml
Created January 8, 2018 16:41
web.config: Multiple `Access-Control-Allow-Origin` values
<!-- https://stackoverflow.com/questions/17323350/access-control-allow-origin-with-multiple-domains -->
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
<add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,PUT,DELETE" />
</customHeaders>
</httpProtocol>
<rewrite>
@greggnakamura
greggnakamura / kentico-html-lang-attribute.html
Last active March 4, 2020 21:51
Accessibility: Kentico <html> lang attribute
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (CurrentDocument != null)
{
CMS.UIControls.ContentPage page = this.Page as CMS.UIControls.ContentPage;
if (page != null)
{
string lang = CMS.Localization.LocalizationContext.CurrentCulture.CultureCode;
page.XmlNamespace += " lang=\"" + lang + "\"";
@greggnakamura
greggnakamura / accessibility-snippets.html
Last active December 13, 2017 19:46
Accessibility: Snippets
// Misc. Accessibility Snippets
<script>
// disable scroll down on spacebar press when a <a> is used like a <button>
$('.sort-options a').on('keydown', function (e) {
if(e.keyCode == 32) {
return false;
}
});
@greggnakamura
greggnakamura / gist:dd0c096ab544ec33950cd05ae78493fb
Last active November 21, 2018 17:02
Accessibility: Various commands
<!-- https://bitsofco.de/pa11y/ -->
<!-- html report -->
pa11y --ignore "warning;notice" --reporter html https://www.nedelta.com/Home > home.html
<!-- pa11y with elements removed -->
pa11y --ignore "warning;notice" https://www.nedelta.com/Home --hide-elements ".wf-header,.wf-footer"
<!-- html report with elements removed -->
pa11y --ignore "warning;notice" --reporter html https://www.nedelta.com/Patients --hide-elements ".wf-header,.wf-footer" > _patients.html
@greggnakamura
greggnakamura / getdatemonthinfo.sql
Last active April 26, 2017 15:17
SQL: Get Date Month Number and Date Month Name from Date field
SELECT DISTINCT
DATEPART(M, SeminarDate) AS MonthPart,
DATENAME(M, SeminarDate) AS MonthName
FROM customtable_MedicareSeminarDates
ORDER BY MonthNo ASC
-- output
MonthNo MonthName
1 January
@greggnakamura
greggnakamura / tabindex-attribute.html
Last active January 17, 2017 05:03
Accessibility: tabindex attribute
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@greggnakamura
greggnakamura / web-accessibility-base-template.html
Last active April 18, 2017 17:10
Accessibility: Base Template
<!doctype html> <!-- Level A 4.1.1 Parsing -->
<html lang="en"> <!-- Level A 3.1.1 Language of Page -->
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Add a unique page title</title> <!-- Level A 2.4.2 Page Titled -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <!-- Level AA 1.4.4 Resize Text -->
<link href="css/main.css" rel="stylesheet" />
@greggnakamura
greggnakamura / get-query-string-param-values.js
Created November 18, 2016 16:06
Javascript: Get query string param values
// http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
@greggnakamura
greggnakamura / table-complex-level-headers.html
Last active May 5, 2017 01:50
Accessibility: Table (complex with multiple levels of headers)
<table>
<caption>Shelly's Daughters</caption>
<tbody><tr>
<td></td>
<th scope="col">Name</th>
<th scope="col">Age</th>
<th scope="col">Birthday</th>
</tr>
<tr>
<th rowspan="2" scope="row">by birth</th>