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 / feed.html
Created September 30, 2011 17:26
[Django 1.3] django.views.generic.TemplateView example
"{{ params.id }}"
@mhulse
mhulse / load.csp
Created October 26, 2011 18:34
Super simple/silly way of separating logic from template using Caché objectscript...
Hey #(foo)# #(bar)#!
<csp:comment>
Output: Hey foo bar!
</csp:comment>
@mhulse
mhulse / Image.csp
Created October 31, 2011 18:51
Caché DTI ContentPublisher: Web Facebook Image URI code example...
<script language="cache" method="imageUri" arguments='field:%String="", cmsStory:dt.cms.schema.CMSStory=-1' returntype="%String" procedureblock="1">
set return = ""
if ($length(field) && $isobject(cmsStory)) {
set cmsPictureId = ##class(dt.cms.support.Rules).extractPicture(field, cmsStory, 0)
if (cmsPictureId '= -1) {
@mhulse
mhulse / example.csp
Created November 1, 2011 23:59
RULE tip using DTI and Caché COS (Objectscript)...
#[ set publication = $get(%request.Data("publication", 1)) ]#
<csp:if condition=($length(publication))>
#(publication)#
<dti:publication:set name="#(publication)#" />
#(gPublication)#
@mhulse
mhulse / urls.py
Created November 10, 2011 20:30
Django: How to upgrade this old functional view to new class based view?
###### NEW:
from django.conf.urls.defaults import *
from sporty import views
urlpatterns = patterns('',
url(
# 30 characters or fewer. Letters, numbers and @/./+/-/_ characters:
r'^users/(?P<username>[a-zA-Z0-9@.+-_]+)/$',
@mhulse
mhulse / dms2dd.as
Created November 29, 2011 23:24
AS3: Method to convert degree-minute-second (DMS) form to decimal degree (DD) form.
/**
* degreeMinuteSecond2DecimalDegree()
* About: Converts degree-minute-second (DMS) form to decimal degree (DD) form.
* Returns: Decimal degree (DD) form.
* @param: String.
*/
private function degreeMinuteSecond2DecimalDegree(s:String):Number {
// http://www.ehow.com/how_2363249_form-decimal-degree-dd-form.html
@mhulse
mhulse / RG tracking code.html
Last active September 28, 2015 18:18
The Register-Guard tracking codes (put before the closing </body> tag in an HTML document) & other stuff...
<!-- [BEGIN] comScore -->
<script>var _comscore=_comscore||[];_comscore.push({c1:'2',c2:'14055685'});(function(){var s=document.createElement('script'),el=document.getElementsByTagName('script')[0];s.async=true;s.src=(document.location.protocol=='https:'?'https://sb':'http://b')+'.scorecardresearch.com/beacon.js';el.parentNode.insertBefore(s,el);})();</script>
<noscript><img src="//b.scorecardresearch.com/p?c1=2&amp;c2=14055685&amp;cv=2.0&amp;cj=1" width="1" height="1" alt=""></noscript>
<!-- [END] comScore -->
<!-- [BEGIN] Quantcast -->
<script>var _qevents=_qevents||[];(function(){var elem=document.createElement('script');elem.src=(document.location.protocol=='https:'?'https://secure':'http://edge')+'.quantserve.com/quant.js';elem.async=true;elem.type='text/javascript';var scpt=document.getElementsByTagName('script')[0];scpt.parentNode.insertBefore(elem,scpt);})();_qevents.push({qacct:'p-a2gE_aSO6ndbI'});</script>
<noscript><img src="//pixel.quantserve.com/pixel/p-a2gE_aSO6ndbI.gif" width="1" height="1" al
@mhulse
mhulse / admin.py
Created December 21, 2011 01:32
Having problems using Treebeard with my django homebrew pages app...
import datetime
from django.contrib import admin
from treebeard.admin import TreeAdmin
from dox.models import Page
#--------------------------------------------------------------------------
#
# Admin models:
#
#--------------------------------------------------------------------------
@mhulse
mhulse / siteheader.csp
Created January 24, 2012 01:34
Caché DTI ContentPublisher: Weather widget example code.
<script language="cache" runat="server">
set id = 1
set exists = ##class(dt.z.guide.weather.hourly).%ExistsId(id)
if (exists) {
set cond = ##class(dt.z.guide.weather.hourly).conditionsGetStored(id)
@mhulse
mhulse / admin.py
Created February 1, 2012 21:54
[Django 1.3] Restrict authors, in admin, to Super Users and Staff only.
from django.contrib.auth.models import User
from django.contrib import admin
from dox.models import Page
#--------------------------------------------------------------------------
#
# Admin models:
#
#--------------------------------------------------------------------------