Skip to content

Instantly share code, notes, and snippets.

View RobertFischer's full-sized avatar

Robert Fischer RobertFischer

View GitHub Profile
@RobertFischer
RobertFischer / Unwrapping.elm
Created November 15, 2017 17:29
The goal is to get a MilestonesMsg created from a GlobalModel instance.
milestoneBtnMsg =
global.selectedCareplan -- Start with the careplan
|> Maybe.andThen .id -- Call .id on it if it's Just; return Nothing if it's Nothing or id is Nothing
|> Maybe.map MilestonesRoute -- Wrap it in a MilestonesRoute if we have a Just
|> Maybe.withDefault DoNothing -- If we have a Nothing, return DoNothing; otherwise, return the value in the Just
providerName =
case global.selectedProvider of
Nothing -> "(None)"
provider.name
-- Same as
providerName = Maybe.unwrap "(None)" .name global.selectedProvider
@RobertFischer
RobertFischer / pretty-print-alternative.js
Created January 9, 2018 14:59
pretty-print replacement
const print = function() { require("console").dir(it); }
@RobertFischer
RobertFischer / index.scss
Created January 9, 2018 21:46
Hide blank Quill sections via SCSS
.ql-blank {
@extend .d-none;
}
@RobertFischer
RobertFischer / index.scss
Created January 9, 2018 22:01
Nesting for .ql-editor
.ql-editor {
font-family: "Museo Sans";
h1 {
font-weight: 500;
font-size: 22pt;
color: #002F5F;
}
h2 {
import Promise from "bluebird";
Promise.try(() => axios.get(CAREPLAN_URL))
.tap(response => console.log(CAREPLAN_URL, response))
.then(response => response.data)
.then(data => this.ds.cloneWithRows(data))
.then(dataSource => this.setState({dataSource}))
.catch(e => console.error("Getting careplan failed", CAREPLAN_URL, e)
;
@RobertFischer
RobertFischer / fib.hs
Last active March 6, 2018 14:07
Haskell fib
fib :: Int -> Int
fib 0 = 0
fib 1 = 1
fib 2 = 2
fib i | i < 0 = error "argument to fib must be > 0"
fib i = fib (i-1) + fib (i-2)
@RobertFischer
RobertFischer / .babelrc
Last active March 6, 2018 21:15
Babel Configuration File for a Nicer Development Environment
{
"presets": [
"react-native"
],
"plugins": [
"transform-strict-mode",
[ "auto-import",
{ "declarations": [
{ "default": "React", "path": "react" },
{ "default": "_", "path": "lodash" },
onClick=>{
() => this.setState({pageNumber:this.state.pageNumber+1})
}
@RobertFischer
RobertFischer / Parchment Processing.jsx
Last active March 12, 2018 16:51
Parchment Processing
// Initialize the loop variables
let currentLine = [] // ops making up the current line
const content = [] // Components that we will ultimately render
// Map parchment attributes to React styling object
const attrsToStyle = (attrs) => {
console.warn("Don't forget to implement styling!");
return {};
};