A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
If you were learning graph algorithms, which approach would you prefer:
Imagine you have to take public transit from your home to your office. How do you figure out the fastest route? Use graph algorithms! OR
We can choose between two standard ways to represent a graph G = (V, E): as a collection of adjacency lists or as an adjacency matrix. Either way applies to both directed and undirected graphs.
I prefer the first way: lead with lots of examples, and clear writing. The second way is an excerpt from "Introduction to Algorithms"...that's how they start their section on graph algorithms.
// ES6 w/ Promises | |
// Note: From a React starter template - see https://t.co/wkStq8y3I5 | |
function fetchData(routes, params) { | |
let data = {}; | |
return Promise.all(routes | |
.filter(route => route.handler.fetchData) | |
.map(route => { | |
return route.handler.fetchData(params).then(resp => { | |
data[route.name] = resp; |
import co from 'co' | |
// Generator controller, | |
// this.models refers to Sequelize models added with server.bind() | |
function* loginController(request) { | |
let user = yield this.models.User.find({ | |
where: { | |
email: request.payload.email | |
} |
export const doTheThing = () => (dispatch, getState) => { | |
const users = getState(); | |
dispatch({ | |
type: 'THE_THING', | |
users, | |
}); | |
}; |
import decamelize from 'decamelize'; | |
import { fromGlobalId } from 'graphql-relay'; | |
import pluralize from 'pluralize'; | |
import getItem from '../api/getItem'; | |
const types = {}; | |
const endpoints = {}; | |
const getItemOverrides = {}; |
#!/bin/bash | |
echo "describe cluster;" > /tmp/dc | |
for i in {1..5}; do | |
echo Attempt $i | |
if cassandra-cli -f /tmp/dc 2>&1 | grep "Cluster Information"; then | |
exit 0 | |
else | |
sudo service cassandra stop; sudo service cassandra start | |
sleep 10 | |
fi |
import React from 'react'; | |
import axios from 'axios'; | |
import Rx from 'rxjs'; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
scores: [] | |
}; |