Skip to content

Instantly share code, notes, and snippets.

@jgambill
jgambill / gist:10281183
Last active August 29, 2015 13:58
Change your list bullet to a custom character in CSS —by Ryan Sechrest #css #icons http://ryansechrest.com/2012/11/change-your-list-bullet-to-a-custom-character-in-css/
ul {
list-style: none;
}
ul li:before {
color: #f00;
content: '» \0000a0'; /* unicode character for space */
font-size: 1.2em;
font-weight: bold;
}
@jgambill
jgambill / gist:10401942
Created April 10, 2014 16:57
create css classes to alternate row color of a list of items using mod function #php #basics
<?php
// assuming a loop where i is incremented
if ($i % 2 == 1) $classes .= " odd";
else $classes .= " even";
?>
@jgambill
jgambill / gist:11010490
Last active August 29, 2015 14:00
align content of a div to the bottom of the div using 'position' #css http://stackoverflow.com/questions/585945/how-to-align-content-of-a-div-to-the-bottom-with-css
<style type="text/css">
#header { position: relative; }
#header-content { position: absolute; bottom: 0; left: 0; }
</style>
<div id="header">
<h1>Title</h1>
<div id="header-content">Some content</div>
</div>
@jgambill
jgambill / gist:af8e86a8249e994244f3
Last active August 29, 2015 14:01
footnotes and works cites/references for essays in html5 #html #html5 #semantic #microformats [http://www.w3.org/TR/html5/common-idioms.html#footnotes, http://microformats.org/wiki/footnotes]
<article>
<p>...Each religious convent became responsible for running a school (nuns’ monasteries were in charge of education for girls)<sup><a href="#fn1" id="r1">1</a></sup> and convents with fewer than eight members were transformed into elementary or high schools (González Serrano 2009: 156-157). ...</p>
<section id="footnotes">
<p id="fn1"><sup><a href="#r1">1</a></sup> The enrollment of girls in elementary schools was very slow after Independence—only 15% of the students were girls in the 1820s, which rose to 45% in 1894, probably as a result of the 1870 reform and its compulsory education provision (Ramírez and Salazar 2010: 443, 446).</p>
</section>
<section id="references">
<h5>References</h5>
@jgambill
jgambill / gist:49b03b5a088d1e1ce2b5
Created May 6, 2014 22:54
load csv into mysql #mysql #sql
LOAD DATA LOCAL INFILE 'C:/path/to/file.csv'
INTO TABLE `tablename`
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(field1,field2,field3)
@jgambill
jgambill / gist:bbf4bfe8e3e01d2bffa4
Last active August 29, 2015 14:01
remove a file from the repo without deleting it from the local file system #git
# add the file to .gitignore, then...
git rm --cached filename
git commit -am 'removed filename'
git push origin master
@jgambill
jgambill / gist:055ca7e03721465580e5
Last active August 29, 2015 14:03
EAD Workshop Sample Finding Aid http://hdl.loc.gov/loc.mss/eadmss.ms010049 #eadworkshop #xml
<?xml version="1.0" encoding="UTF-8"?>
<ead xmlns="urn:isbn:1-931666-22-9" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:isbn:1-931666-22-9 http://www.loc.gov/ead/ead.xsd"
id="sample">
<!-- eadheader: Description of the collection, not the items in the collection. Includes all the DACS required elements (yellow elements on sheet in packet) -->
<eadheader>
<!-- mainagencycode: ISO name for Library of Congress -->
<!-- countrycode: ISO name for the United States -->
<eadid mainagencycode="US-DLC" countrycode="US">http://hdl.loc.gov/loc.mss/eadmss.ms010049</eadid>
<!-- a schema for my postcard, with some commented-out stuff for other possibilities -->
<!-- ?. *, + act the same as quantiifers in regex -->
<!-- file extension has an extra .xml on the end to get github to color-code properly -->
element postcard {
<!-- attribute example
element date {
attribute iso-date { xsd:gYear }?,
text
},-->
element sender { text },
@jgambill
jgambill / libstats
Created July 15, 2014 21:12
Libstats data dump with human-friendly field values. For sending to staff in a spreadsheet. #libstats #mysql #sql
SELECT question_id, li.short_name, lo.location_name, qt.question_type, q.question_type_other, t.time_spent, q.referral_id, p.patron_type, qf.question_format, q.initials, q.hide, q.obsolete, q.question_date, q.client_ip, q.question, q.answer, q.delete_hide, q.date_added FROM libstats.questions q
LEFT JOIN libstats.libraries li on li.library_id=q.library_id
LEFT JOIN libstats.locations lo on lo.location_id=q.location_id
LEFT JOIN libstats.question_types qt on qt.question_type_id=q.question_type_id
LEFT JOIN libstats.patron_types p on p.patron_type_id=q.patron_type_id
LEFT JOIN libstats.question_formats qf on qf.question_format_id=q.question_format_id
LEFT JOIN libstats.time_spent_options t on t.time_spent_id=q.time_spent_id
LEFT JOIN libstats.users u on q.user_id=u.user_id
WHERE delete_hide=0
ORDER BY q.question_date ASC
@jgambill
jgambill / timestamp
Created November 21, 2014 19:48
Convert timestamp to date in Excel #excel
=(((A1/60)/60)/24)+DATE(1970,1,1)