Skip to content

Instantly share code, notes, and snippets.

View ghickman's full-sized avatar
🏠
hash tag farm lyfe

George Hickman ghickman

🏠
hash tag farm lyfe
View GitHub Profile
WITH ethnicities AS (
SELECT
Patient_ID,
date,
ethnicity_code,
ROW_NUMBER() OVER (
PARTITION BY Patient_ID ORDER BY date DESC
) AS row_num
FROM (
SELECT
@ghickman
ghickman / add_inline.js
Created June 11, 2011 11:19
Add an inline Django form to the formset without reloading the page.
function add_inline_form(prefix) {
var count = parseInt($('#id_' + prefix + '-TOTAL_FORMS').val(), 10);
var last_form = $('.' + prefix + ':last');
var new_form = last_form.clone(false).html(last_form.html().replace(
new RegExp(prefix + '-\\\\d-', 'g'), prefix + '-' + count + '-'));
new_form.find('input[type="text"], textarea').each(function () {
$(this).val('');
});
new_form.hide().insertAfter(last_form).slideDown(300);