Skip to content

Instantly share code, notes, and snippets.

View jeremyboggs's full-sized avatar

Jeremy Boggs jeremyboggs

View GitHub Profile
@jeremyboggs
jeremyboggs / sort_items_by_title.php
Created June 4, 2013 14:20
Sort Omeka Items alphabetically by title by default.
<?php
function custom_item_browse_sql($select, $params) {
$sortField = 'Dublin Core,Title'; // 'Element Set Name, Element Name'
$sortDir = 'ASC'; //ASC or DESC
if (!isset($params['sort_field'])) {
$select->reset('order');
get_db()->getTable('Item')->applySorting($select, $sortField, $sortDir);
<!DOCTYPE HTML>
<html>
<head>
<title>Dropdowns</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('header nav li').hover(
@jeremyboggs
jeremyboggs / convert_search_filters.php
Created April 23, 2013 13:48
Converts Omeka's advanced search output into acceptable input for findBy().
<?php
/**
* Converts the advanced search output into acceptable input for findBy().
*
* @see Omeka_Db_Table::findBy()
* @param array $query HTTP query string array
* @return array Array of findBy() parameters
*/
function neatlinetime_convert_search_filters($query) {
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#map { height: 500px; }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAzygx7txI_uXKJX1JD_czX7iH8BGRubI0&sensor=false">
</script>
<!DOCTYPE HTML>
<html>
<head>
<title>CSS Practice</title>
<style type="text/css">
</style>
</head>
<body>
<h1>CSS Practice</h1>
@jeremyboggs
jeremyboggs / filter_elements.php
Last active December 14, 2015 21:59
Hides elements unless an Omeka user is logged in.
<?php
/**
* Unset elements if there is not current authenticated user.
*/
function filter_elements($elementsBySet) {
/* An array of elements in sets to be hidden from non-authenticated users. */
$hiddenElements = array(
'Dublin Core' => array(
<meta name="viewport" content="width=device-width">
<?php
$string = '$(document).ready(function() {projekktor(".projekktor").setFile(' . $playlist . ');});';
queue_js_string($string);
?>
<?php if ($collection = get_collection_by_id(@$_GET['collection'])) {
echo $collection->name;
echo $collection->description;
} ?>
@jeremyboggs
jeremyboggs / back-to-top.js
Created January 21, 2013 14:48
Simple back-to-top button with jQuery.
/**
* Show or hide the button depending on the scroll position.
*/
function animateButton() {
var button = $('#back-to-top');
var scrollPosition = $(window).scrollTop();
if (scrollPosition > 400) {
button.fadeIn();
} else {
button.fadeOut();