Skip to content

Instantly share code, notes, and snippets.

Avatar

Dylan Wood dylancwood

View GitHub Profile
@dylancwood
dylancwood / tree.css
Last active Oct 20, 2020
CSS to create a simple tree structure with connecting lines. No images or JS required.
View tree.css
ul.tree, ul.tree ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.tree ul {
margin-left: 10px;
}
ul.tree li {
margin: 0;
@dylancwood
dylancwood / install_fips.sh
Last active Jul 14, 2016
Shell script to compile and install FIPS-validated Open SSL as well as Apache 2.4. Tested on Ubuntu 12.04. This script does not verify the fingerprint of the OpenSSL FIPS object module, and is therefore incomplete. It is a good place to start though.
View install_fips.sh
#!/bin/bash
echo "installing updates"
sudo apt-get update
echo "installing build-essential"
sudo apt-get install build-essential
echo "moving to home dir"
cd ~
@dylancwood
dylancwood / informed_redirect.html
Created Nov 21, 2013
Simple webpage to inform users that a resource has changed locations, and redirect after 10 seconds. Has some cute graphics that are pure CSS: no images for the fastest possible loading times.
View informed_redirect.html
<!DOCTYPE html>
<html>
<head>
<script>
;{
var render_timer, initialize_page
, old_app_name = 'Self Assessment'
, new_app_name = 'Participant Portal'
, old_app_url = 'http://chronus.mrn.org/self'
, new_app_url = 'http://coins.mrn.org/p2';
@dylancwood
dylancwood / php_leading_zero_numbers.php
Last active Dec 31, 2015
This simple script illustrates that PHP interprets digits with leading zeros as an octal. This can cause problems when interpreting user input as an integer without converting it to a string first then parsing it (e.g with intval()).
View php_leading_zero_numbers.php
<?php
echo 'This simple script illustrates that PHP interprets digits with leading zeros as an octal. This can cause problems when interpreting user input as an integer without converting it to a string first then parsing it (e.g with intval()).';
echo '<br>Notice that numbers greater than 7 do not compare nicely with their leading-zero counterparts.';
echo '<br>';
echo '9';
echo '<br>';
echo '9==09 ... ';
echo iif(9==09, 'true', 'false');
echo '<br>';
echo '9==9 ... ';
@dylancwood
dylancwood / split.js
Created May 10, 2014
AppData Cleanup!!
View split.js
/*
TODO:
write a new file that contains calls to each function found in each of the splitFileDirPath
function getSubjectTags() {
return className->getSubjectTags($args);
}
Address methods that reference other methods as '$this->doSomething()'
+ $this->select() Could be addressed by each class extending BaseAppData
+ Grep for methods defined in File 'A' that are referenced in File 'B' using $this->
+ Alternatively, change all calls to '$this' to be $AppData.
@dylancwood
dylancwood / testserver.js
Last active Aug 29, 2015
Quick server to test whether http module automatically decodes url
View testserver.js
var http = require('http');
var server = http.createServer();
server.on('request', function(req, res) {
console.log(req.url);
res.end();
});
server.listen(8123);
View gist:3ab0569cff6996c17724
'use strict';
//TODO: add '['api']' tags to each route (see auth/login.js for exampe)
//TODO: also add notes and description fields for swagger.
const boom = require('boom');
exports.register = function(server, options, next) {
const path = '/scans';
// TODO: should be Scan
View post.md

I spent a little time in a Promise rabbit-hole today, and thought I'd share two rules-of-thumb that I came up with to avoid such holes in the future. This came from writing Mocha tests, but it applies to lots of code:

Example:

describe('Some Async Test', () => {
    var myPromise;
    before('Do some async setup', () => {
        myPromise = doSomethingAsync();
        return myPromise;
View badChannels.md

Here's how bad channel data is stored in the COINS DB: Each scan session is stored as a row in the mrs_scan_sessions table. Multiple scan series may be associated with each scan, and are stored in the mrs_series table. Scan metadata categories like bad channels are stored in the mrs_scan_data_types table. Series are associated with many metadata categories the mrs_series_data table (which contains a series_id, a scan_data_type_id and a value).

Exporting this data through our more modern API would result in the following format:

[
@dylancwood
dylancwood / data-record-schema.xml
Created Dec 10, 2015
add schema for data-records and data-uploads
View data-record-schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="add tables for independent-blob schema"
author="DWOOD">
<comment>Create tables for file-record and file-upload schema</comment>
You can’t perform that action at this time.