Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Midgley science

  • California, USA
View GitHub Profile
View postgres-fast-import.rb
# NOTE: This is sample code that may not include libraries that are required by this method
# This method is just to demonstrate how to do fast imports from STDIN directly to Postgres
# This method was written a long time ago, so it may no longer function as described
# The following code was ripped from a library and not run, so it may not be fully functional as published
module TableLoader
# return each line with the newline value for the platform in question
# we strip any newlines from the end of each line and replace them with
# Ruby "\n" which should be platform specific
def TableLoader::get_line_from_file(file_handle)
@science
science / forward-sms-to-email-twilio
Created Jul 16, 2019
Forward SMS from a twilio number to email using SendGrid API
View forward-sms-to-email-twilio
const got = require('got');
exports.handler = function(context, event, callback) {
const requestBody = {
personalizations: [{ to: [{ email: context.TO_EMAIL_ADDRESS }] }],
from: { email: context.FROM_EMAIL_ADDRESS },
subject: `New SMS message from: ${event.From}`,
content: [
{
type: 'text/plain',
View Handles8.1License.txt
A. HANDLE.NET PUBLIC LICENSE AGREEMENT (Ver.1)
This Handle.Net Public License Agreement (ver.1) ("License Agreement")
is between Corporation for National Research Initiatives ("CNRI"),
having an office at 1895 Preston White Drive, Reston, VA 20191-5434,
and the Individual or Organization ("Licensee") that has accessed,
installed or otherwise used the software owned by CNRI called
HANDLE.NET® and its included documentation ("HDL Software")
(collectively the "Parties"). Licensee shall be deemed to have entered
into, signed and agreed to be bound by the terms and conditions of
@science
science / json-ld.json
Created Jun 24, 2016
JSON-LD definition in json-schema format
View json-ld.json
{
"title": "Schema for JSON-LD",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions":{
"context": {
"additionalProperties": true,
"properties": {
"@context": {
"description": "Used to define the short-hand names that are used throughout a JSON-LD document.",
@science
science / cti_credential_schema.json
Created Jun 24, 2016
CTI Credential json-schema definition - DRAFT/IN PROGRESS
View cti_credential_schema.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "CredentialRegistry Organization metadata",
"type": "object",
"definitions": {
"organization_cti": {
"properties": {
"@type": { "enum": ["cti:Organization"] },
@science
science / registry_data_envelope.json
Created Jun 24, 2016
Data envelope that wraps a data resource for management by metadata registry
View registry_data_envelope.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Data envelope",
"type": "object",
"definitions": {
"envelope": {
"properties": {
"envelope_type": {
"description": "Defines the type of the envelope. For now, the only accepted value is \"resource_data\"",
@science
science / cti_organization_schema.json
Created Jun 24, 2016
JSON-schema definition for organization - DRAFT/IN PROGRESS
View cti_organization_schema.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "CredentialRegistry Organization metadata",
"type": "object",
"definitions": {
"organization_cti": {
"properties": {
"@type": { "enum": ["cti:Organization"] },
@science
science / enum.json
Created Jun 14, 2016
Sample Enumeration example for schema.org
View enum.json
{
"books": [
{"@bookType": "hardcover",
"title": "Gone with the Wind"
},
{"@booktype": "eBook",
"title": "The Great Gatsby"}
]
}
@science
science / paradata disavowal example.json
Created Mar 8, 2016
A sample json-ld schema.org structure with an optional "disavowal" paradata statement, refuting the metadata provided
View paradata disavowal example.json
{
"@id": "http://docsteach.org/activities/16/detail",
"@type": "CreativeWork",
"name": "The Constitution at Work",
"thumbnailUrl": "http://docsteach.org/assets/lesson/000/000/022/22_medium.jpg",
"url": "http://docsteach.org/activities/16/detail",
"paradata": {
"activity": {
"actor": "organization",
"verb": {
@science
science / merged envelope.json
Last active Mar 17, 2016
LR 2.0 "merged" envelope returned from API - see line 8 for sample concept
View merged envelope.json
{
"@id": "http://docsteach.org/activities/16/detail",
"@type": "CreativeWork",
"name": "The Constitution at Work",
"thumbnailUrl": "http://docsteach.org/assets/lesson/000/000/022/22_medium.jpg",
"url": "http://docsteach.org/activities/16/detail",
"description": "In this activity students will analyze documents that span the course of American history to determine their connection to the U.S. Constitution. Students will then make connections between the documents they have examined and the big ideas found within the Constitution.",
"typicalAgeRange":
[
{"value": "13-18",