Skip to content

Instantly share code, notes, and snippets.

@jweisman
jweisman / 1.xml
Created April 7, 2022 12:16
MARCXML Records
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<collection>
<record>
<leader>
12288cam 22006611i 4500
</leader>
<controlfield tag="001">
9983540000561
</controlfield>
<controlfield tag="005">
@jweisman
jweisman / cloud-app-testing.ts
Last active November 16, 2021 13:19
Tests for Ex Libris Cloud App Scaffolding
import { ComponentFixture } from "@angular/core/testing";
import { CloudAppRestService, EntityType, PageInfo } from "@exlibris/exl-cloudapp-angular-lib";
import { of, Subject } from "rxjs";
import { map } from "rxjs/operators";
const PAGE_INFO: PageInfo = {
entities: [{
"id": "23140519980000561",
"type": EntityType.ITEM,
"description": "AUT1469",
@jweisman
jweisman / curl.sh
Last active March 10, 2022 19:43
Alma API Error Handling
#!/bin/bash
URL=https://api-na.hosted.exlibrisgroup.com/almaws/v1/users/fdsa
curl ${URL} -vs -H 'accept: application/json' -H "authorization: apikey $ALMA_APIKEY" | jq
@jweisman
jweisman / custom.js
Last active August 4, 2021 20:20
Primo Customization - Graph DB
var app = angular.module('viewCustom', ['angularLoad']);
/* Other Works */
app.controller('OtherWorksComponentController', ['$http', function ($http) {
var vm = this;
const mms_id = vm.parentCtrl.item.pnx.control.sourcerecordid && vm.parentCtrl.item.pnx.control.sourcerecordid[0] || '';
if (mms_id) {
const data = {
"statements": [{
"statement": `MATCH
@jweisman
jweisman / index.php
Last active August 10, 2021 12:18
Ingest Form for Alma Digital
<?php
function alma_get($url) {
$opts = [
"http" => [
"header" => "Accept: application/json\r\n" .
"Authorization: apikey " . getenv('ALMA_APIKEY') . "\r\n"
]
];
$context = stream_context_create($opts);
$json = file_get_contents($url, false, $context);
@jweisman
jweisman / index.js
Created May 3, 2021 09:49
Alma BIB API - Working with XML
var alma = require ('almarestapi-lib');
var xpath = require('xpath');
var dom = require('xmldom').DOMParser
const XPATH_TITLE = '/record/datafield[@tag="245"]/subfield[@code="a"]';
const XPATH_AUTHOR = '/record/datafield[@tag="100"]/subfield[@code="a"]';
const MMS_ID = '99469654400561';
let title, author, bib, doc;
( async () => {
@jweisman
jweisman / settings.component.html
Last active November 16, 2020 09:58
Saving an image in Cloud App Settings
<div class="eca-actions">
<button mat-flat-button color="secondary" [routerLink]="['/']">Back</button>
<button mat-flat-button color="primary" (click)="save()">Save settings</button>
</div>
<div class="loading-shade" *ngIf="loading">
<mat-progress-spinner mode="indeterminate" diameter="50"></mat-progress-spinner>
</div>
<h1>Settings</h1>
<h2>Logo</h2>
<div><img src="{{logoUrl}}" style="max-width: 100%;"/></div>
@jweisman
jweisman / files.csv
Last active November 13, 2020 13:07
Upload digital files programmatically using Alma APIs
99509041500561 logo.png
99509041400561 logo.png
99509041300561 logo.png
99509041200561 logo.png
99508941400561 logo.png
99509041100561 logo.png
99508841400561 logo.png
@jweisman
jweisman / LambdaPublicIP.yaml
Last active November 9, 2020 11:22
CloudFormation template to create resources necessary to run a Lambda function with a static public IP
####
# Based on https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html
# and https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/templates/vpc-privatepublic.yaml
####
pubPrivateVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 172.31.0.0/16
Tags:
@jweisman
jweisman / proxy.component.html
Last active September 4, 2020 12:26
Ex Libris Cloud App Angular Component for use with an API Proxy
<h1>Using a Proxy to Access Data from Other Institutions</h1>
<div class="loading-shade" *ngIf="loading"><mat-spinner diameter="50"></mat-spinner></div>
<mat-form-field appearance="fill">
<mat-label>Intitution</mat-label>
<mat-select #instcode>
<mat-option *ngFor="let inst of instcodes" [value]="inst">{{inst}}</mat-option>
</mat-select>
</mat-form-field>
<button mat-flat-button color="primary" (click)="test(instcode.value)">Test connection</button>