Skip to content

Instantly share code, notes, and snippets.

macro_rules! code_value {
(
$NAME:ident {
$(
$( $IN:pat )|+ => $VARIANT:ident => $OUT:expr
),*
}
) => (
#[derive(Clone, Copy, Debug)]
pub enum $NAME {
@app.route('/manifest/:id', methods=['POST'])
def manifest():
user = get_user_from_db_by_id(id)
return send_file('/tmp/dash/' + user.manifest_filename + '.mpd', filename=(str(id) + '.mpd'))
@jacobmischka
jacobmischka / CatAlgorithmPromis.diff
Created April 19, 2017 15:50
CatAlgorithmPromis Diff
diff --git a/src/main/java/edu/stanford/survey/server/CatAlgorithmPromis.java b/src/main/java/edu/stanford/survey/server/CatAlgorithmPromis.java
index cbf03a8e..a8cca090 100644
--- a/src/main/java/edu/stanford/survey/server/CatAlgorithmPromis.java
+++ b/src/main/java/edu/stanford/survey/server/CatAlgorithmPromis.java
@@ -70,7 +70,8 @@ public CatAlgorithm initialize(ItemBank itemBank) {
int nCategory = 0;
for (Response r : item.responses()) {
if (r.difficulty() < 1 || r.difficulty() > item.betas().length + 1) {
- throw new IllegalArgumentException("Item " + item.code() + " has a response with a difficulty out of range");
+ log.debug("Item " + item.code() + " has a response with a difficulty out of range");
import debounce from 'lodash/debounce';
import { isInView } from './utils.js';
const header = document.querySelector('.site-header');
let headerRect = header.getBoundingClientRect();
window.addEventListener('resize', debounce(() => {
headerRect = header.getBoundingClientRect();
}, 100));
impl DataSchemaValue for schema::MonitorCodeType {
fn from_value(data: &calamine::DataType) -> Result<schema::MonitorCodeType, MCWAnesthError> {
if let calamine::DataType::String(ref input) = *data {
match &input as &str {
"A Line" => Ok(schema::MonitorCodeType("Arterial Line".to_string())),
"CVP Line" => Ok(schema::MonitorCodeType("Central Venous Line".to_string())),
"PA Line" => Ok(schema::MonitorCodeType("Pulmonary Artery Line".to_string())),
"TEE" => Ok(schema::MonitorCodeType("Transesophageal Echocardiogram".to_string())),
"BIS" => Ok(schema::MonitorCodeType("Bispectral Index".to_string())),
"EEG" => Ok(schema::MonitorCodeType("Electroencephalogram".to_string())),
@jacobmischka
jacobmischka / mod.rs
Created May 12, 2017 18:57
schema.rs
//! # Schema types
//! Enumerate valid types in AQI Schema
extern crate chrono;
extern crate regex;
use self::chrono::prelude::{Date, DateTime, Local};
use self::regex::Regex;
use ::AQIError;
@jacobmischka
jacobmischka / EmailGenerator.js
Created May 19, 2017 15:16
Export static styled-jsx from client
import React, { Component } from 'react';
import { renderToString, renderToStaticMarkup } from 'react-dom/server';
import flush from 'styled-jsx/server';
import PropTypes from 'prop-types';
import ActiveEvent from './ActiveEvent.js';
export default class EmailGenerator extends Component {
constructor(props) {
super(props);
import React, { Component } from 'react';
import { renderToString, renderToStaticMarkup } from 'react-dom/server';
import PropTypes from 'prop-types';
import download from 'downloadjs';
import ActiveEvent from './ActiveEvent.js';
export default class EmailGenerator extends Component {
constructor(props) {
@jacobmischka
jacobmischka / .editorconfig
Created July 19, 2017 12:28
registry editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Built-in Atom Packages (91)
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]