Skip to content

Instantly share code, notes, and snippets.

@hectorcorrea
hectorcorrea / webserver.js
Last active June 29, 2024 12:51
web server in node.js
// A very basic web server in node.js
// Stolen from: Node.js for Front-End Developers by Garann Means (p. 9-10)
var port = 8000;
var serverUrl = "127.0.0.1";
var http = require("http");
var path = require("path");
var fs = require("fs");
var checkMimeType = true;
@hectorcorrea
hectorcorrea / .bashrc
Last active August 23, 2024 13:00
My .bashrc (this is actually in my .bash_profile)
PS1="\w \$ "
alias ls='ls -G -la'
# Git aliases
alias st='git status'
alias br='git branch'
alias co='git checkout'
alias lg='git log'
alias df='git diff'
@hectorcorrea
hectorcorrea / dpla.html
Last active August 29, 2015 14:15
DPLA API Demo in plain HTML + JavaScript
<!DOCTYPE html>
<html>
<head>
<title>DPLA API demo</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<h2>DPLA API Demo</h2>
<p>Enter your DPLA API and git <i>Go</i> to fetch images from the Getty Trust</p>
@hectorcorrea
hectorcorrea / rdf4rdbms.md
Last active August 23, 2024 13:03
RDF for Relational Database heads
@hectorcorrea
hectorcorrea / ldp_containers.md
Last active May 7, 2024 17:35
A summary of the basic differences between the different kind of containers that LDP supports.

This document is a summary of the basic differences between the different kind of containers that Linked Data Platform (LDP) supports.

LDP specifies three types of containers:

  1. Basic Container
  2. Direct Container
  3. Indirect Container.

This documents describes the differences between the three types of containers by showing what triples are added by an LDP Server when adding a new element to each kind of container.

In particular we assume we have a fictitious blog entry (/blog/entry1/) and we want to add a comment to it. We start by showing what happens if the blog entry is a Basic Container, then we show what happens if the blog entry was instead a Direct Container, and lastly if it was an Indirect Container.

@hectorcorrea
hectorcorrea / frbr.md
Last active August 29, 2015 14:24
Notes from FRBR + Fedora + Inheritance meeting

FRBR + Fedora + Inheritance

My notes from the Google Hangout organized by Christina Harlow (@cm_harlow) on 7/14/2015

Keep in mind that I captured this as the video call went on and I might have gotten some of it wrong. I'll update this page with a link to the recording once it becomes available.

What is FRBR?

FRBR (Functional Requirements for Bibliographic Records) is a 1998 recommendation of the International Federation of Library Associations and Institutions (IFLA) to restructure catalog databases to reflect the conceptual structure of information resources. - http://www.oclc.org/research/activities/frbr.html

@hectorcorrea
hectorcorrea / forever-initd-hectorcorrea.sh
Last active January 18, 2017 17:39
A sample init.d script to start a CoffeeScript application through forever. This used to be part of the source code of my hectorcorrea.com repo but since I have deleted the CoffeeScript code this script was lost. This gist is to preserve it for posterity since it is referenced in a StackOverflow question.
#!/bin/bash
#
# initd-example Node init.d
#
# chkconfig: 345
# description: Script to start a coffee script application through forever
# processname: forever/coffeescript/node
# pidfile: /var/run/forever-initd-hectorcorrea.pid
# logfile: /var/run/forever-initd-hectorcorrea.log
#
@hectorcorrea
hectorcorrea / node_modules-in-git.md
Created January 19, 2017 16:34 — forked from sukima/node_modules-in-git.md
Archive of mikeal's post since his server went down today

node_modules in git

December 10 2011
By mikeal

One of the many things we have been forced to rethink in the world of node is how we handle dependencies in applications.

One of the big changes that came with 0.4.0 was support for node_modules. This change had major consequences. It elevated local modules, in a local directory, above modules installed globally. Along with npm changing its default install preference to local rather than global we've seen a nearly unanimous shift to local module installs that has made global installs somewhat distasteful.

@hectorcorrea
hectorcorrea / server.go
Last active October 10, 2017 17:00
An example on how to generate a local SSL certificate in Go and serve HTTPS traffic with it
// An example on how to generate a local SSL certificate in Go
// and serve HTTPS traffic with it.
//
// Code taken from the book Go Web Programming by Sau Sheong Chang
// https://github.com/sausheong/gwp
//
// Run with `--https` to serve traffic via HTTPS (it will create the certificate
// and private key files if they don't exist)
//
// Run with no parameters to serve traffic via HTTP (no certificates needed)