Skip to content

Instantly share code, notes, and snippets.

View mhulse's full-sized avatar
👋
👁 ❤️ open source software …

Michael Hulse mhulse

👋
👁 ❤️ open source software …
  • Instructure Inc.
  • Eugene, Oregon
View GitHub Profile
@mhulse
mhulse / device.css
Last active August 29, 2015 14:17 — forked from jsoverson/device.css
.visible-android {
display:none;
}
.visible-ios {
display:none;
}
.on-device .visible-android, .on-device .visible-android {
display:inherit;
}
.device-ios .visible-android {
@mhulse
mhulse / not-online.js
Last active August 29, 2015 14:19
[not-online] Simplistic JavaScript code to detect if network is online/offline; "online" is assumed to be the default mode.
/*! not-online | https://gist.github.com/mhulse/ce208d2c64f1ce160a6a */
;(function(document, navigator) {
!navigator.onLine && (document.documentElement.className = document.documentElement.className.replace(/\bonline\b/, 'not-online'));
}(document, navigator));
/*! not-online uglified | https://gist.github.com/mhulse/ce208d2c64f1ce160a6a */!function(document,navigator){!navigator.onLine&&(document.documentElement.className=document.documentElement.className.replace(/\bonline\b/,"not-online"))}(document,navigator);
@mhulse
mhulse / stavffEmail.csp
Created April 6, 2011 22:17
Get staff e-mails via DTI's Content Publisher CMS. Language keywords: CSP (Caché Server Page), COS (Caché Objectscript)
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="email" arguments='name:%String=""' returntype="%String" procedureblock="1">
set return = ""
try {
set currentNS = $znspace
znspace ##class(dt.common.NamespaceProcs).GetLocationsName()
@mhulse
mhulse / relativeDate01.csp
Created April 6, 2011 22:21
Returns a relative date. Language keywords: CSP (Caché Server Page), COS (Caché Objectscript)
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="timesince" arguments='ts1:%String="", ts2:%String=""' returntype="%String" procedureblock="1">
/*
**
** Note: dformat/tformat are not currently used.
** Read comments below for more info.
**
** More info:
@mhulse
mhulse / cleanList.csp
Created April 7, 2011 00:50
Trim whitespace around items in a delimited string. Language keywords: CSP (Caché Server Page), COS (Caché Objectscript)
<script language="cache" method="OnPreHTTP" arguments="" returntype="%Boolean">
do %response.SetHeader("Content-Type", "text/plain")
quit 1
</script>
#[ new string set string = " Top Story , Top Stories , Other Stories , Bulleted Stories " ]#
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="cleanListM1" arguments='str:%String=""' returntype="%List" procedureblock="1">
@mhulse
mhulse / story.csp
Created April 12, 2011 00:35
Previous/Next story in section: 2011 update for DTI's Content Publisher (Lightning) CMS 7.6.x!
<dti:file:include base="assets" file="/includes/csp/story.prevnext.inc.csp?areas=Top Story,Top Stories,Other Stories,Bulleted Stories,Updates" />
@mhulse
mhulse / Test.as
Created April 21, 2011 01:42
Test if document class or assigned to movieclip/sprite in library.
package {
// Imports:
import flash.display.*;
import flash.events.*;
/**
* AS3 test class.
*
* <p>Tests if this class is a "Document" class
@mhulse
mhulse / nab.csp
Created May 5, 2011 18:12
Caché Objecscript CSP method used to extract strings out of other strings.
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="nab" arguments='haystack:%String="", from:%String="", to:%String=""' returntype="%String" procedureblock="1">
set return = ""
if ($length(haystack) && $length(from) && $length(to)) {
//set from = "data="""
//set to = """"
@mhulse
mhulse / swfsize.csp
Created May 5, 2011 19:10
DTI's Content Publisher CMS: Just experimenting with some code that gets all SWFs attached to a story.
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="getSwf" arguments='cmsStory:dt.cms.schema.CMSStory=-1' returntype="%ArrayOfDataTypes" procedureblock="1">
set sc = $$$OK
set return = ##class(%ArrayOfDataTypes).%New()
set storyId = cmsStory.story.storyId
set currentNS = $znspace
znspace ##class(dt.common.NamespaceProcs).GetNewsMediaName()
@mhulse
mhulse / cgi.csp
Last active September 25, 2015 19:17
Caché Objecscript CSP code that obtains/tests for Extra CGI Environment Variables.
<ol>
<li>AUTH_PASSWORD: #($get(%request.CgiEnvs("AUTH_PASSWORD"), "empty"))#</li>
<li>AUTH_TYPE: #($get(%request.CgiEnvs("AUTH_TYPE"), "empty"))#</li>
<li>CONTENT_TYPE: #($get(%request.CgiEnvs("CONTENT_TYPE"), "empty"))#</li>
<li>GATEWAY_INTERFACE: #($get(%request.CgiEnvs("GATEWAY_INTERFACE"), "empty"))#</li>
<li>HTTP_ACCEPT_CHARSET: #($get(%request.CgiEnvs("HTTP_ACCEPT_CHARSET"), "empty"))#</li>
<li>HTTP_ACCEPT_LANGUAGE: #($get(%request.CgiEnvs("HTTP_ACCEPT_LANGUAGE"), "empty"))#</li>
<li>HTTP_AUTHORIZATION: #($get(%request.CgiEnvs("HTTP_AUTHORIZATION"), "empty"))#</li>
<li>HTTP_COOKIE: #($get(%request.CgiEnvs("HTTP_COOKIE"), "empty"))#</li>
<li>HTTP_REFERER: #($get(%request.CgiEnvs("HTTP_REFERER"), "empty"))#</li>