Skip to content

Instantly share code, notes, and snippets.

happyrainb

Block or report user

Report or block happyrainb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@happyrainb
happyrainb / dataset.csv
Created Sep 25, 2016
The input csv file for importing data into ckan. Made in 05/2016, tested in testing site, never in production.
View dataset.csv
id name title category notes owner_org
7285f5c2-412a-4264-95fe-39c658d8be3z hdlcusp10212z A New Dataset test some category This is a test 1de1bfef-1450-4b1f-9783-aba1419a5fd4
7285f5c2-412a-4264-95fe-39c658d8be3z2 hdlcusp10213z A 2nd New Dataset test some category This is a test 1de1bfef-1450-4b1f-9783-aba1419a5fd4
@happyrainb
happyrainb / ckan-update.py
Created Sep 25, 2016
This script will update ckan records using a .csv as the input data. Made in 05/2016, tested in testing site, never used in production. It uses the provided connection script to make api call.
View ckan-update.py
import ckanapi
import csv
from copy import deepcopy
def update_dataset_api_call(connection, dataset_data):
'''
This function uses the provided connection to make an api call that updates the dataset title
:param connection:
:return: None
@happyrainb
happyrainb / insert-record.py
Created Sep 25, 2016
This script will insert record into ckan. Tested in testing site, never used in production. Made in 05/2016.
View insert-record.py
import ckanapi
mysite = ckanapi.RemoteCKAN('http://xxxx',
apikey='xxx',
user_agent='ckanapiexample/1.0 (+http://example.com/my/website)')
data = {
"title": "UrbanSound",
"license_title": "Creative Commons Attribution",
"maintainer": "",
View ckan-cusp-schema.json
{
"scheming_version": 1,
"dataset_type": "dataset",
"about": "A reimplementation of the default CKAN dataset schema",
"about_url": "http://github.com/ckan/ckanext-scheming",
"dataset_fields": [
{
"field_name": "title",
"label": "Title",
"preset": "title",
@happyrainb
happyrainb / Get-license-360Link2.js
Created May 25, 2015
This Javascript file adds a license link to each of the e-resources in 360Link 2.0 user interface.
View Get-license-360Link2.js
jQuery(document).ready(function() {
// get all the elements that have a class name '.resource-name'
var links = jQuery(".resource-name");
// go through the elements and add a link after each one based on the text each element contains
for(var i =0; i<links.length; i++){
// turn the current item into a jquery object
var el = jQuery(links[i]);
@happyrainb
happyrainb / Summon2-license.js
Last active Aug 29, 2015
Add license links to Summon 2.0 user interface using "Source"
View Summon2-license.js
/*
* Script to customize Summon UI ver 2 made by Wittawat Meesangnil
* Hi SerSol, this seems safe enough, if you think this script breaks anything - let us know.
* Many thanks to @daveyp, @mreidsma, and @godmarback
*/
//fixing OCT 15 2014 - Summon now load stuffs from CDN with LAB.js, everything is async, non-blocking
//think of this as a wake up call, and learn how to "hacking Summon - the elegant way"
//our custom translation here - they've finally fixed it
@happyrainb
happyrainb / Summon1-use360Api.php
Last active Aug 29, 2015
This file works with the Summon1-use360LinkApi.js to get the licesne links for each database and add the links to Summon 1.0.
View Summon1-use360Api.php
<?php
/*
* A simple example function using 360Link API to make a pop-up window to display all the databases
* for a full text article in Summon 1.0
* and assign license links which are created in Mondo License Grinder
* Made and modified by Jenny Jing, Qinqin Lin
* Last Modified: Dec. 16, 2014
*/
function get_xml_result($url) { //this function is copied online: http://journal.code4lib.org/articles/108
@happyrainb
happyrainb / Summon1-use360API.js
Last active Dec 23, 2016
Summon1-use360API.js: The orginal script is called Summon-clicks.js which is made by Matthew Reidsma & Adam Luckenbaugh. You need to save this javascript on you web server and put the ULR to: ProQuest’s Client Center>Summon Admin>Custom Link> URL. You will need another file (apiArticle.php) to be stored in the same directory on your web server.
View Summon1-use360API.js
/*
* Script to log summon usage statistics & customize Summon UI
* http://gvsu.summon.serialssolutions.com/search?s.cmd=nextPage%28%29&s.light=t&s.pn=4&s.q=test
* Authors: Matthew Reidsma & Adam Luckenbaugh
* Version 1.2
* Last Edited by: Jenny Jing & Sharifi Ahmed, 05/24/2015
* Function: find the ISSN and DOI in each record displayed in Summon result page, and use them as the input for 360Link API, in order to generate the links in the mini-popup window.
*/
$(document).ready(function() {
@happyrainb
happyrainb / Voyager License links
Last active Aug 29, 2015
Voyager-OPAC-Add links: Go to the sandbox folder in Voyager – WebVoyage and modify the display.xsl. Find the xxxx/contentLayout/display: open display.xsl. Then find the <xsl:template name=”BMD3000″> and <xsl:param name=”marc”/> <xsl:param name=”recordType”/><xsl:for-each select=”$marc/slim:datafield[@tag='856']“> <xsl:if test=”string-length($new…
View Voyager License links
@happyrainb
happyrainb / 360_get_names.js
Last active Aug 29, 2015
360 Link Get Database names: Script to find the SS_DatabaseHyperLink in the 360 Link search result page and add the license Info link to that provider. You can also add links to other classes in that page use this method.
View 360_get_names.js
/* Script to database provider name in the 360 Link search result page and add the license Info link to that provider.
<script type="text/javascript" language="JavaScript" src="http://xxx/jquery-1.9.0.js"></script>
Please copy the "http://code.jquery.com/jquery-1.9.0.js" to your web site and replace the URL.
Please insert the URL of this JavaScript file "http://xxx/get_license.js"in 360 Link Admin>Header.
*/
$(document).ready(function()
{
You can’t perform that action at this time.