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 / cookie.html
Created May 8, 2014 17:57
Mobile site switcher demo page for the Django Mobile app.
@mhulse
mhulse / tojs.csp
Last active August 29, 2015 13:56
Caché Server Pages Hyperevents Example.
<script language="cache" method="MakeList2" arguments="myFlag:%String">
&js<console.log("i see #(myFlag)#");>
</script>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
@mhulse
mhulse / box.csp
Created January 20, 2014 19:44
NEWSCYCLE Solutions: DTI Lighting: Convert Delimited "Agate" to HTML Tables, a test ...
<script language="cache" method="pull" arguments='needle:%String="", haystack:%String="", to:%String=""' returntype="%ListOfDataTypes">
; TODO: Add comments.
new return
set return = ##class(%ListOfDataTypes).%New()
if ($length(needle) && $length(haystack) && $length(to)) {
new first, last
@mhulse
mhulse / attribute.csp
Last active December 22, 2015 11:48
Test page for <dti:area:include /> and <dti:story:topnslots ... >...</dti:story:topnslots>.
<script language="cache" runat="server">
new demo
/*
**--------------------------------------------------------------------------
**
** Demo settings:
**
**--------------------------------------------------------------------------
@mhulse
mhulse / class.utility.php
Last active December 22, 2015 07:59
PHP simple utility class demo code.
<?php
class Utility
{
public static function foo($arg = '') {
echo sprintf('<p>This class is "%s"; it\'s method is "%s"; the arg is "%s"</p>', get_class($this), __FUNCTION__, $arg);
}
@mhulse
mhulse / 1. pseudo-functions-BEFORE.php
Last active December 21, 2015 03:59
How can I improve my functions organization (inspired to ask this question from reading http://justintadlock.com/archives/2010/12/30/wordpress-theme-function-files)?
<?php
if ( ! function_exists('foo_setup')) {
function foo_setup() {
add_theme_support(...);
add_theme_support(...);
}
@mhulse
mhulse / Examples.md
Last active December 21, 2015 00:59
Caché example of how to trick the compiler into allowing CSP tags inside a (Javascript) tag/block.

Sometimes it's necessary to put CSP tags inside JS tags, like:

#[ new test set test = "BLAH" ]#

<script>
	
	var foo = "Hello world";
	
	
@mhulse
mhulse / comment01.csp
Created August 13, 2013 17:24
RG's Disqus comment.csp form with example of how to insert gStory.%Id().
<hr>
<div class="w_row">
<div class="w_col w_C130 Aoff Boff">&nbsp;</div>
<div class="w_col w_C640 w_D980">
<section>
@mhulse
mhulse / Get the latest entry from the SEOStoryLookup table.csp
Created July 16, 2013 21:45
Caché 2009.1 - DTI Lightning 7.7.x: Get the latest entry from the SEOStoryLookup table.
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="lookup" arguments='story:dt.cms.schema.CMSStory=-1' returntype="%String" procedureblock="1">
; Initialize result value:
set result = ""
; dt.cms.schema.CMSStory?
set:($isobject(story)) story = story.%Id() // Get its ID.
@mhulse
mhulse / .bash_profile
Created July 15, 2013 21:29
My .bash_profile/.bashrc setup.
# Google:
export PATH=${PATH}:$HOME/gsutil
# http://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows
# http://superuser.com/questions/137438/how-to-unlimited-bash-shell-history
# https://www.kernel.org/doc/man-pages/online/pages/man3/strftime.3.html
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
export HISTTIMEFORMAT="%a %h %d - %r " # timestamps