This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original code by MadaraUchiha | |
// Just defines named types we can reference by key. Never used as a real value type. | |
interface Operations<T> { | |
'delete': never; | |
'nullable': T | null; | |
'box': {value: T}; | |
}; | |
type MemberConfig<T> = keyof Operations<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import { accessor } from 'react-big-calendar/lib/utils/accessors'; | |
import { accessor as accessorPropType } from 'react-big-calendar/lib/utils/propTypes'; | |
import { noop } from 'lodash'; | |
import { zonedToLocal, localToZoned } from '/client/utils/timezones'; | |
import { hasTime, shiftDate, shiftHour } from '/client/utils/date'; | |
/** | |
* withTimeZone - HOC to add time zone support to react-big-calendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const KEYWORD_MAP = {}; | |
/* | |
KEYWORD_MAP[<user_id>][<term>] returns the reply | |
*/ | |
KEYWORD_MAP[774078] = { | |
'jesus': 'http://i.imgur.com/V1kcfEU.jpg' | |
}; | |
KEYWORD_MAP[617762] = { | |
'BAM!' : 'SPACE GUN!' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git | |
GIT_REF = $(shell git rev-parse --abbrev-ref HEAD) | |
GIT_REV = $(shell git rev-parse HEAD) | |
# CI | |
CI_COMMIT_REF_SLUG ?= $(GIT_REF) | |
CI_ENVIRONMENT_SLUG ?= local | |
CI_RUNNER_DESCRIPTION ?= $(shell hostname) | |
# Debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class Notification extends Component { | |
render() { | |
var type = this.props.type == null ? 'default' : this.props.type; | |
return <div className={"notification " + type}>{this.props.message}{this.props.cancellable == 1 && <i className="material-icons" onClick={this.props.onCancel}></i>}</div>; | |
} | |
} | |
export default Notification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import moment from 'moment'; | |
const DEFAULT_DISPLAY_FORMAT = 'MM/DD/YYYY'; // what the input shows when the user isn't typing | |
const DEFAULT_DATA_FORMAT = 'YYYY-MM-DD'; // the value is expected to be in this format and this control ouputs this format | |
const DEFAULT_ACCEPTED_FORMATS = [ //the user may type of of these | |
'MM/DD/YYYY', | |
'M/D/YY', | |
'M/D', | |
'MM-DD-YYYY', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { spawn } from 'child_process'; | |
// app is an express server | |
app.get('/some/url/:someOption' function(req, res, next) { | |
let { someOption } = req.params; | |
let commandProcess = spawn('node', ['someScript.js', someOption]); | |
commandProcess.stdout.setEncoding('utf8'); | |
commandProcess.stderr.pipe(process.stderr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import './valueInspector.less'; | |
import Immutable from 'immutable'; | |
export default class ValueInspector extends Component | |
{ | |
render() { | |
let referenceTracker = new CircularReferenceTracker(); | |
let path = Immutable.List(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by http://www.intelligiblebabble.com/making-reactjs-and-knockoutjs-play-nice | |
import ko from 'knockout'; | |
import ReactDOM from 'react-dom'; | |
const reactBindingHandler = { | |
init(element, valueAccessor, allBindings, viewModel, bindingContext) { | |
// make sure we cleanup, later. | |
ko.utils.domNodeDisposal.addDisposeCallback(element, function() { | |
ReactDOM.unmountComponentAtNode(element); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function fixBookShelfES6Inheritance(target) { | |
// console.log('Fixing:', target.name); | |
let parentConstructor = Object.getPrototypeOf(target.prototype).constructor; | |
let parentStaticProperties = Object.keys(parentConstructor); | |
// console.log('Adding static properties:', parentStaticProperties); | |
// TODO: Deal with static methods that want to call super() (right now they are REPLACED!) | |
parentStaticProperties.forEach(propName => target[propName] = parentStaticProperties[propName]); | |
} |