Skip to content

Instantly share code, notes, and snippets.

View kimisgold's full-sized avatar

Kim Nguyen kimisgold

View GitHub Profile
@kimisgold
kimisgold / # mysql - 2016-09-27_16-14-56.txt
Created September 27, 2016 21:05
mysql on macOS 10.11.6 - Homebrew build logs
Homebrew build logs for mysql on macOS 10.11.6
Build date: 2016-09-27 16:14:56
@kimisgold
kimisgold / 0_reuse_code.js
Created June 20, 2014 20:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kimisgold
kimisgold / submenu-check.php
Created December 19, 2013 19:01
Check to see if Omeka main public nav has submenus.
<?php
$nav = new Omeka_Navigation;
$nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);
$nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME);
$view_nav = get_view()->navigation()->menu($nav)->getPages();
foreach($view_nav as $page) {
if($page->hasPages()) {
echo 'has submenus';
break;
}
@kimisgold
kimisgold / gist:3913093
Created October 18, 2012 16:38
search form helper edits
<?php echo $view->form('search-form', $options['form_attributes']); ?>
<?php echo $view->formText('query', $_GET['query']); ?>
<?php if ($options['show_advanced']): ?>
<fieldset id="advanced-form">
<fieldset id="query-types">
<p><?php echo __('Search using this query type:'); ?></p>
<?php echo $view->formRadio('query_type', $_GET['query_type'], null, $validQueryTypes); ?>
</fieldset>
<?php if($validRecordTypes): ?>
<fieldset id="record-types">
@kimisgold
kimisgold / gist:3913019
Created October 18, 2012 16:30
advanced search markup
<form id="search-form" name="search-form" method="get" action="/~knguyen/omeka/admin/search">
<input type="text" name="query" id="query" value="">
<fieldset id="advanced-form">
<fieldset id="query-types">
<p>Search using this query type:</p>
<label><input type="radio" name="query_type" id="query_type-full_text" value="full_text" checked="checked">Full text</label><br>
<label><input type="radio" name="query_type" id="query_type-boolean" value="boolean">Boolean</label><br>
<label><input type="radio" name="query_type" id="query_type-exact_match" value="exact_match">Exact match</label>
</fieldset>
<fieldset id="record-types">
@kimisgold
kimisgold / gist:3137431
Created July 18, 2012 16:54
select dropdown
<style>
quick-filter-wrapper {
height: 25px;
background: #e2e2e2; /* Fallback */
background: url('../images/dropdown-arrow.png') no-repeat right center; /* Fallback */
background: url('../images/dropdown-arrow.png') no-repeat right center, linear-gradient(top, #f8f8f8, #e2e2e2);
background: url('../images/dropdown-arrow.png') no-repeat right center, -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#e2e2e2));
background: url('../images/dropdown-arrow.png') no-repeat right center, -webkit-linear-gradient(top, #f8f8f8, #e2e2e2);
background: url('../images/dropdown-arrow.png') no-repeat right center, -moz-linear-gradient(top, #f8f8f8, #e2e2e2);
@kimisgold
kimisgold / gist:2998458
Created June 26, 2012 19:53
JDH Table of Contents template
<?php
/*
Template Name: Archived Table of Contents
*/
?>
<?php get_header(); ?>
<div class="front-page twelve columns offset-by-two omega">
@kimisgold
kimisgold / gist:2913134
Created June 11, 2012 22:32
Example of creating a list of links using a Simple Vocab term
<li>Time Period
<?php
$db = get_db();
$timePeriodId = $db->getTable('Element')->findByElementSetNameAndElementName('Item Type Metadata', 'Time Period')->id;
$timePeriodTexts = explode("\n", $db->getTable('SimpleVocabTerm')->findByElementId($timePeriodId)->terms);
if($timePeriodTexts) {
echo '<ul class="sub-menu">';
foreach($timePeriodTexts as $timePeriodText) {
echo '<li>' . bc_link_to_items_with_element_text($timePeriodText, array(), 'browse', $timePeriodId, $timePeriodText) . '</li>';
}
@kimisgold
kimisgold / bc_link_to_items_with_element_text.php
Created June 11, 2012 21:56
Custom link to items with element text helper
@kimisgold
kimisgold / gist:2876950
Created June 5, 2012 18:55
Searching for item types within a collection using MultiCollections plugin
<?php if($multiItems = multicollections_get_items_in_collection(10, 'Book')):
foreach($multiItems as $multiItem) {
if($fullsizeHtml = item_fullsize(array('class' => 'theme-book-cover', 'alt' => item('Dublin Core','Title')))) {
echo '<div class="theme-book">';
echo '<a href="'.item('permalink').'">'.$fullsizeHtml.'</a>';
echo '<p class="theme-book-meta three columns omega"><span class="theme-book-title">'.link_to_item().'</span><br><span class="theme-book-author">by '.item('Dublin Core','Creator').'</span></p>';
echo '</div>';
}
}
endif;