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 / query1.txt
Created August 5, 2011 19:07
Caché iSql query vs. CSP/COS: The latter is missing the most recent cms.ID.
SELECT DISTINCT cms.ID
FROM dt_cms_schema.CMSStory cms, dbo.AdDbPageInfo adbpi, dbo.StoryPageElements spe, dbo.Story s, dbo.SubCategory sc, dbo.status st, dbo.Desk d
WHERE (adbpi.runDate BETWEEN '2011-04-27' AND '2011-08-05')
AND cms.story->storyId = s.storyId
AND sc.subCategoryId = 191173
AND s.storyId = spe.storyId
AND spe.logicalPagesId = adbpi.logicalPageId
AND s.subCategoryId = sc.subCategoryId
AND s.StatusId = st.StatusId
AND s.deskId = d.deskId
@mhulse
mhulse / map.js
Created August 25, 2011 20:47
Google Maps v3: Load KML Layer...
/* Show map until loaded?
http://groups.google.com/group/google-maps-js-api-v3/msg/a9dda851790a6c54
*/
function showCrossHair(divId) {
var mmap = document.getElementById(divId);
var div = document.createElement('div');
div.id = 'crossHair';
div.style.position = 'absolute';
div.style.padding = '0';
@mhulse
mhulse / admin.py
Created September 6, 2011 04:33
Django google maps v3 snipplet [via] admin example (tested in Django 1.4.x)
from django.contrib import admin
from myapp.models import Foo
from myapp.forms import FooForm
class FooAdmin(admin.ModelAdmin):
form = FooForm
prepopulated_fields = { 'slug': ['title'] }
@mhulse
mhulse / admin.py
Created September 18, 2011 02:11
Django admin starter template (A.K.A. my attempt at organizing the Django's admin.py file).
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from <app>.models import Foo, Bar, Baz
from <app>.forms import BazForm
# https://docs.djangoproject.com/en/dev/ref/contrib/admin/
#--------------------------------------------------------------------------
#
# Classes:
@mhulse
mhulse / admin.py
Created September 18, 2011 07:52
Django (1.4.0, a0) & CKEditor (3.6.2): Using Django's jQuery and CKEditor's jQuery adaptor...
# ...
# Note: I put the CKEditor package in my "static" folder.
# The below "Media" paths are relative to STATIC_URL.
# Don't forget to collectstatic for your <app_name> css/js.
class FooAdmin(admin.ModelAdmin):
form = FooForm
@mhulse
mhulse / admin.py
Created September 18, 2011 21:23
SORL (and description example) in Django's admin change list view...
# ...
from sorl.thumbnail import get_thumbnail
# ...
# http://stackoverflow.com/questions/1378447/question-about-admin-py-list-display
def _get_photo(obj):
if obj.photo: # 'photo' = model field name.
im = get_thumbnail(obj.photo, '60')
@mhulse
mhulse / admin.py
Created September 19, 2011 19:25
Django google maps v3 snipplet [via] admin example (tested in Django 1.4.x) (second example)
from <app_name>.models import Foo
# ...
# Using the default admin interface:
admin.site.register(Foo)
@mhulse
mhulse / admin.py
Created September 20, 2011 17:18
Django (1, 4, 0, 'alpha', 0): Trying to get custom model field to pass custom attribute to form (and eventually a widget)... What am I doing wrong here?
from django.contrib import admin
from test.models import Test
admin.site.register(Test)
@mhulse
mhulse / data.kml
Created September 22, 2011 19:39
Snippet of my kml file: HTML5 <audio> tag not working.
...
<Placemark>
<name>Crawdads!</name>
<Point>
<coordinates>-122.980987,44.003205</coordinates>
</Point>
<Snippet><![CDATA[0-2108157 @ 08/27/2011 04:51:32 p.m.]]></Snippet>
<description><![CDATA[
Crawdads!
@mhulse
mhulse / map.js
Created September 25, 2011 23:54
Google Maps v3 geoXML infoWindow HTML in external DIV example...
var options = {
map: map,
singleInfoWindow: true,
// suppressInfoWindows: true, // If "false", then no access to infoWindow html. :(
createMarker: myCreateMarker
};
var overlay = new geoXML3.parser(options);
overlay.parse('http://foo.com/data.kml?v=' + parseInt(Math.random()*99999999));