This file contains hidden or 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 log --no-merges --since="21 days ago" --pretty=format:%an --numstat | awk '/./ && !author { author = $0; next } author { ins[author] += $1; del[author] += $2 } /^$/ { author = ""; next } END { for (a in ins) { printf "%10d %10d %10d %s\n", ins[a] - del[a], ins[a], del[a], a } }' | sort -rn |
This file contains hidden or 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
| // standardize square size | |
| iconSizeX = 50 | |
| iconSizeY = 50 | |
| gridSizeX = 20 | |
| gridSizeY = 15 | |
| shipX = Math.floor(gridSizeX / 2) | |
| shipY = gridSizeY - 1 | |
| grid = Array(gridSizeY).fill().map(() => Array(gridSizeX).fill(' ')) | |
| shots = [] |
This file contains hidden or 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
| /**** Use it like this ****/ | |
| /* | |
| RW = new RetryWrapper({max: 3, delay: 3000}); | |
| RW.fetch('http://www.google.com/') | |
| .then(r => console.log('worked', r)) | |
| .catch(e => console.error('whoops', e)); | |
| */ | |
| class RetryWrapper { |
This file contains hidden or 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
| // sometimes you want to queue up messages for a component that isn't loaded yet | |
| // This is the type of problem RXJS is useful for... | |
| // ...but I didn't want to import RXJS for such a simple need | |
| // Use it like this: | |
| ///////// In your producer code ////////////////// | |
| // import Observable from '_shared/util/Observable'; | |
| // o = new Observable(); | |
| // |
This file contains hidden or 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
| pool.q = (...args) => new Promise ((resolve, reject) => { | |
| pool.query(...args, (error, ...successParams) => { | |
| if(error) { | |
| console.error('MYSQL Error:', error); | |
| reject(error.toString()); | |
| } | |
| else { | |
| resolve({ | |
| results: successParams[0], | |
| fields: successParams[1] |
This file contains hidden or 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 * as d3 from "d3"; | |
| var i = 0; | |
| let radius; | |
| const donut = function() { | |
| var data = [], | |
| width, | |
| height, | |
| margin = {top: 10, right: 10, bottom: 10, left: 10}, |
This file contains hidden or 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 Gauge from '../../visualizations/gauge'; | |
| import * as _ from 'lodash'; | |
| class ComponentGauge extends Component { | |
| constructor (props) { | |
| super(props); | |
| } | |
| componentDidMount() { | |
| this.gauge = new Gauge(this.refs.gauge, _.extend({ |
This file contains hidden or 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 * as d3 from "d3"; | |
| import * as _ from 'lodash'; | |
| export default function(container, configuration) { | |
| let that = {}; | |
| // eventually these should be class members | |
| let svg, | |
| r, | |
| tickData, |
This file contains hidden or 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
| // Returns array of keys that are different between the two objects | |
| // takes account of values that differ between matching keys or missing keys from either object | |
| // result is deduped | |
| function diffObjects (a, b) { | |
| return _(a).toPairs().xorBy(_.toPairs(b), JSON.stringify).fromPairs().keys().value(); | |
| } |
This file contains hidden or 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
| class Clock extends React.Component { | |
| constructor (props) { | |
| super(props); | |
| console.log('props', props); | |
| this.state = { | |
| timeTarget: props.timeTarget, | |
| days: 0, | |
| hours: 0, |
NewerOlder