Skip to content

Instantly share code, notes, and snippets.

View snreid's full-sized avatar

Sarah Reid snreid

  • Doximity
View GitHub Profile

Keybase proof

I hereby claim:

  • I am snreid on github.
  • I am snreid (https://keybase.io/snreid) on keybase.
  • I have a public key ASArq2ZIxQoW8_DrxxVPxcKAmEQbEeyBAJupXfFWiitmGQo

To claim this, I am signing this object:

@snreid
snreid / gist:5246361885acf7b42106
Last active September 11, 2023 17:30
Jquery DataTables Custom Search Box

I ran into an issue recently where I restyled a page with a searchable table and broke the plugin it was using. I replaced the plugin for Jquery DataTables, but I wanted the page to look the same, so I didn't want to use the built-in search box that DataTables comes with.

After a lot of digging around I found my solution.

##The Javascript

$(document).ready(function(){
var table = $('#person_listing').DataTable();
   //DataTable custom search field
@snreid
snreid / gist:66413ce82089210785c5
Last active August 29, 2015 14:08
Attribute Before Cast Issue with Date

http://robots.thoughtbot.com/how-rails-works-type-casting I found this link very helpful.

I was having an issue validating a date. I needed the date to either match my format or be empty.

Here's what my validation looked like:

validate :expiration_date, format:{with: /(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])/}, allow_nil: true
@snreid
snreid / gist:788e9d14803eefc6dbfd
Last active August 29, 2015 14:07
ArchivesSpace include plugin in scripts/build_release

If you have to build a new release of ArchivesSpace, and have a custom plugin that you want to include in that build (so you don't have to manually copy and paste it in) here's how to do it.

In the build/ directory there is a file called build.xml. This controls a lot of stuff when you build a release, including which plugins are added to the zipped end result.

There are 'mkdir' commands that are executed and included in the release. For us this is around line 400 of this build.xml file, just after this text

...
<!-- Dist build -->
@snreid
snreid / gist:695894b9cfd1e2b2e1f4
Last active August 29, 2015 14:06
Most often used Linux/Mac OSX Commands (Incomplete)
ls -al
cd
pwd
mv folder/file new-folder/
sudo !! (after I’ve realized for the zillionth time I didn’t run the command as sudo)
cp file.txt new-folder/
@snreid
snreid / gist:07891f14866d0b96cd11
Created September 4, 2014 18:11
DSpace SAF import shell script
#!/bin/bash
# First parameter is the handle of the collection, e.g. '1811/12345'
# Second parameter is the directory that contains our batch,
# which should include the SimpleArchiveFormat directory.
# Usage example:
# ./import-saf-2dsp.sh 1811/12345 /mnt/common/dspace/OARDC_bulletin_PDF
# The 'mapfile' and 'log' will be new files created by this process.
# The 'mapfile' is used if something goes wrong to delete the batch, see 'delete.sh'.
@snreid
snreid / gist:5e7a48d43c09977a966d
Last active August 29, 2015 14:06
Handy Git Commands

##Create, Merge, Delete Branch

Create new branch:

git checkout -b new_branch

Push new branch:

git push origin new_branch

@snreid
snreid / gist:f365f06a3ed30c74ea29
Created May 23, 2014 13:19
Savon Gem Configuration
#In your gemfile add:
gem 'savon', '~>2.0'
#In your model (or service; whatever is appropriate for your app):
def self.get_response(method, message)
client = Savon.client(
wsdl: 'https://Your-WSDL-URL.com/service.wsdl',
#This is optional. I needed it to send credentials with custom xml. Custom XML will be nested in the <header></header> tags.
soap_header: '<custom-xml-header></custom-xml-header>',