Skip to content

Instantly share code, notes, and snippets.

Avatar

Dale Anderson danderson00

View GitHub Profile
@danderson00
danderson00 / pipeline.js
Created Feb 26, 2019
Simple middleware execution pipeline
View pipeline.js
module.exports = (api, middleware, context) => (
middleware.reverse()
.reduce(
(next, current) => executor(current, next, context),
(...args) => Promise.resolve(api.handler.apply(api.hostObject, args))
)
)
const executor = (middleware, next, context) => (
(...args) => (
@danderson00
danderson00 / TimeZoneInfo.json
Created Jun 20, 2018
JSON serialized output of the .NET TimeZoneInfo.GetSystemTimeZones method
View TimeZoneInfo.json
[
{
"Id": "Dateline Standard Time",
"DisplayName": "(UTC-12:00) International Date Line West",
"StandardName": "Dateline Standard Time",
"DaylightName": "Dateline Daylight Time",
"BaseUtcOffset": "-12:00:00",
"AdjustmentRules": null,
"SupportsDaylightSavingTime": false
},
@danderson00
danderson00 / timezoneConversions.json
Created Jun 20, 2018
Convert Windows time zone names to IANA names. Derived from http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml using the `001` territory for each zone.
View timezoneConversions.json
{
"Dateline Standard Time": "Etc/GMT+12",
"UTC-11": "Etc/GMT+11",
"Aleutian Standard Time": "America/Adak",
"Hawaiian Standard Time": "Pacific/Honolulu",
"Marquesas Standard Time": "Pacific/Marquesas",
"Alaskan Standard Time": "America/Anchorage",
"UTC-09": "Etc/GMT+9",
"Pacific Standard Time (Mexico)": "America/Tijuana",
"UTC-08": "Etc/GMT+8",
@danderson00
danderson00 / servicenow.js
Last active Jan 20, 2019
ServiceNow Authentication
View servicenow.js
const fetch = require('node-fetch')
const querystring = require('querystring')
var data = querystring.stringify({
"grant_type": "password",
// client_id and client_secret are from the System OAuth -> Application Registrations screen on the ServiceNow portal
"client_id": "",
"client_secret": "",
// username and password are valid user credentials for a user in the ServiceNow instance
"username": "",
You can’t perform that action at this time.