Skip to content

Instantly share code, notes, and snippets.

View mike-douglas's full-sized avatar

Mike Douglas mike-douglas

View GitHub Profile
#include <SPI.h>
#include <WiFi101.h>
typedef struct {
int input;
char name[10];
} sensor;
sensor sensors[2] = {
{ 0, "soil03" },
import React from 'react'
import ReactDOM from 'react-dom'
export default class SquareImage extends React.Component {
constructor(props) {
super(props)
this.state = {
height: 0,
width: 0,
@mike-douglas
mike-douglas / webpack.config.js
Last active November 12, 2015 21:25
Simple Webpack config for ES6 projects
module.exports = {
entry: './app.jsx',
output: {
filename: 'bundle.js',
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader'
@mike-douglas
mike-douglas / fabfile.py
Created July 26, 2013 18:13
A Fabric task for deploying static websites hosted with NGINX
from fabric.api import (
task,
settings,
env,
)
from fabric.contrib.project import rsync_project
from fabtools import require
from fabtools.vagrant import vagrant
@mike-douglas
mike-douglas / gist:4693012
Last active December 12, 2015 01:39
ZSH completion recipe for Fabric files
#compdef fab
_fabric() {
_arguments -C -s \
'(-H)'-H'[Sets the host(s)]:Host:_hosts' \
'*:: :->subcmds' && return 0
if (( CURRENT > 0 )); then
sub_command=(${$($name -l|tail -n+2)%f})
#!/usr/bin/env python
from hashlib import sha1
from redis import Redis
import json
def redis_memoize(cache, conn=None):
"""Decorator to cache function calls in redis. Stores as JSON so the data is somewhat portable"""
@mike-douglas
mike-douglas / index.html
Created November 8, 2012 13:55 — forked from anotherjavadude/index.html
Most simple d3.js stack bar chart from matrix
<!DOCTYPE html>
<html>
<head>
<title>Simple Stack</title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
svg {
border: solid 1px #ccc;
font: 10px sans-serif;
shape-rendering: crispEdges;
@mike-douglas
mike-douglas / gist:4001288
Created November 2, 2012 13:06 — forked from markmarkoh/gist:2969317
World Map Geo JSON data
var countries_data = {"type":"FeatureCollection","features":[
{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[74.92,37.24],[74.57,37.03],[72.56,36.82],[71.24,36.13],[71.65,35.42],[71.08,34.06],[69.91,34.04],[70.33,33.33],[69.51,33.03],[69.33,31.94],[66.72,31.21],[66.26,29.85],[62.48,29.41],[60.87,29.86],[61.85,31.02],[60.84,31.5],[60.58,33.07],[60.94,33.52],[60.51,34.14],[61.28,35.61],[62.72,35.25],[63.12,35.86],[64.5,36.28],[64.8,37.12],[66.54,37.37],[67.78,37.19],[69.32,37.12],[70.97,38.47],[71.59,37.9],[71.68,36.68],[73.31,37.46],[74.92,37.24]]]]},"properties":{"name":"Afghanistan"},"id":"AF"},
{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[19.44,41.02],[19.37,41.85],[19.65,42.62],[20.07,42.56],[20.59,41.88],[20.82,40.91],[20.98,40.86],[20.01,39.69],[19.29,40.42],[19.44,41.02]]]]},"properties":{"name":"Albania"},"id":"AL"},
{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[2.96,36.8],[8.62,36.94],[8.18,36.52],[8.25,34.64],[7.49,33.89],[9.06,3