Skip to content

Instantly share code, notes, and snippets.

function archiveWeeks(tasks) {
var startOfDay = (date) => new Date(date).setHours(0, 0, 0);
return lodash.chain(tasks)
.reverse()
.groupBy((task) => startOfDay(task.get('created_at'))
.map((tasks, date) => ({tasks: tasks, date: new Date(date)}))
.groupBy(weekOf) // because I'm lazy
.map((days, week) => ({days: days, week: week}))
.value();
var resultPromises = Object.keys(queries).map(function(){
var value = queries[key];
return populateTables(value);
});
Promise.all(resultPromises).then(runThisAfterAllFinish);
// TODO: Sort by order, using a collectionjs
var failedExons = geneExons
.filter(function(geneExon){
return geneExon.bins[0].pct > 0 || geneExon.bins[1].pct > 0;
})
.map(function(geneExon){
return {
exon: geneExon,
pct: geneExon.bins[0].pct + geneExon.bins[1].pct
var WHForm = React.createClass({
handleBlur: function() {
this.props.commitChanges(this.state);
},
handleChange: function(ev) {
var state = this.state;
this.state[ev.target.name] = ev.target.value;
this.setState(state);
const KEY = Symbol('my key')
function makeFoo(){
return {
[KEY]: 'my secret key',
get key(){
return this[KEY];
}
};
}
const KEY = Symbol('my key')
const fooProto = {
get key() {
return this[key]
}
};
function makeFoo() {
const foo = Object.create(fooProto);
const KEY = Symbol('my key');
class Foo {
constructor(){
this[KEY] = 'my secret key';
}
get key(){
return this[KEY];
}
}
import { Component } from "react";
export var Enhance = ComposedComponent => class extends Component {
static displayName = "Enhanced"
constructor() {
super();
this.state = { data: null };
}
componentDidMount() {
@brigand
brigand / Enhance.js
Last active August 29, 2015 14:18 — forked from sebmarkbage/Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
static displayName = "Enhanced"
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
@brigand
brigand / Avatar.js
Last active August 29, 2015 14:18 — forked from ryanflorence/Avatar.js
import React from 'react';
import md5 from 'MD5';
class Avatar extends React.Component {
static propTypes = {
email: React.PropTypes.string,
size: React.PropTypes.number
}
static defaultProps = {