Skip to content

Instantly share code, notes, and snippets.

View csusbdt's full-sized avatar

David Turner csusbdt

View GitHub Profile
@csusbdt
csusbdt / self-rendering.html
Last active May 28, 2022 23:18
self-rendering markdown
/*
How to use this script
Assuming this script is stored under filename md.js,
your html file will look some like the following.
-------------------------------------------------------
<script src="md.js"></script>
# Social media sites
@csusbdt
csusbdt / wave.cpp
Last active October 5, 2015 12:42
Generate a wav file that plays a 440 Hz sine wave.
/***********************************************************************
*
* Music generation code created by David Turner
* csusbdt@gmail.com
* https://github.com/csusbdt/ambient-music/
*
***********************************************************************
#include <iostream>
#include <cmath>
@csusbdt
csusbdt / index.html
Created January 13, 2013 16:56
How to store JSON data into the user's Google drive storage.
<html>
<head>
<!--
In this example, I started with the 5-minute example provided by Google
on the following page:
https://developers.google.com/drive/
I modified the example code, so that I could write the following
@csusbdt
csusbdt / gist:4351124
Last active December 10, 2015 00:28
Node express request handler that returns Facebook channel.html with one-year expiration.
// Return Facebook channel.html with one-year expiration.
app.get('/channel.html', function(req, res) {
var channelDoc = '<script src="//connect.facebook.net/en_US/all.js"></script>';
res.set({
'Content-Type': 'text/html',
'Content-Length': channelDoc.length,
'Pragma': 'public',
'Cache-Control': 'max-age=31536000',
'Expires': new Date(Date.now() + 31536000000).toUTCString()
});