Skip to content

Instantly share code, notes, and snippets.

View jeremyboggs's full-sized avatar

Jeremy Boggs jeremyboggs

View GitHub Profile
@jeremyboggs
jeremyboggs / get_tags_for_items_in_collection.php
Created April 4, 2011 16:31
Omeka function to return Tags associated with Items in a given Collection.
<?php
/**
* Return Tags associated with Items in a given Collection.
*
* @param Collection
* @return array Tags.
*/
function get_tags_for_items_in_collection($collection = null) {
// If collection is null, get the current collection.
@jeremyboggs
jeremyboggs / url_to_link.php
Created April 29, 2011 14:38
Function to convert any URLs in a given string to links.
@jeremyboggs
jeremyboggs / snippet_by_word_count.php
Created May 16, 2011 13:17
Retrieve a substring of the text by limiting the word count. Taken from Omeka and slightly modified.
<?php
/**
* Retrieve a substring of the text by limiting the word count.
* Note: it strips the HTML tags from the text before getting the snippet
*
* @param string $text The text string to snip.
* @param integer $maxWords The number of words to return from the text.
* @param string $endString Optional string to use on the end of the
* returned snippet. Uses '&hellip;.' by default.
* @return string
@jeremyboggs
jeremyboggs / filter_items_by_exhibit.php
Created June 3, 2011 21:58
Filters the 'item_browse_sql' select in Omeka to return items in a given Exhibit.
<?php
// Hook the 'filter_items_by_exhibit' into the Items SQL.
add_plugin_hook('item_browse_sql', 'filter_items_by_exhibit');
/**
* Filters the 'item_browse_sql' select to return items in a given
* Exhibit. Checks for the existence of a parameter called 'exhibit'
* with a value of either an Exhibit object or Exhibit ID.
*/
@jeremyboggs
jeremyboggs / omeka_alt_item_layouts
Created June 12, 2011 15:32 — forked from anonymous/omeka_alt_item_layouts
Omeka Code Aiming to Create Alternate Item Layouts by Collection (but not working)
<?php head(array('title' => item('Dublin Core', 'Title'),'bodyid'=>'items','bodyclass' => 'show')); ?>
<?php $collectionName = collection('Name', get_collection_for_item());
if ($collectionName == 'Media Reports and Commentary'): ?>
<div id="primary">
<h5><?php echo item('Dublin Core', 'Title'); ?></h5>
@jeremyboggs
jeremyboggs / omeka-toggle-element-texts.js
Created June 16, 2011 16:34
Quick script to show/hide Omeka element texts if you click on that element's heading.
jQuery(document).ready(function($){
// Hide all the element texts to start.
$('.element-set .element-text').hide();
// When you click a h3 inside a .element, show it's sibling .element-text div.
// Also adds some CSS at the end to use the pointer cursor.
$('.element-set .element h3').click(function(){
$(this).siblings('.element-text').toggle('slow');
}).css({'cursor': 'pointer'});
});
@jeremyboggs
jeremyboggs / display_image_gallery_for_item.php
Created June 17, 2011 19:38
Displays a simple JavaScript-powered image gallery for an Omeka item. Clicking on a thumbnail displays its larger image. Requires jQuery.
@jeremyboggs
jeremyboggs / link_to_controller.diff
Created August 30, 2011 17:47
link_to controller Omeka diff
@jeremyboggs
jeremyboggs / link_tags_to_static_page.php
Created August 31, 2011 19:16
Link Tags to Static Page
#! /usr/bin/env bash
DOTFILES = ~/.dotfiles
mkdir ~/.dotfiles.old
for i in ~/.vim ~/.vimrc ~/.gvimrc ~/vimfiles ~/.bash_profile ~/.gitignore ~/.gitconfig; do
[ -e $i ] && mv $i ~/.dotfiles.old
done