Skip to content

Instantly share code, notes, and snippets.

View davidrichards's full-sized avatar

David Richards davidrichards

View GitHub Profile
@davidrichards
davidrichards / README.md
Created April 8, 2016 02:04
Simple Discrete Distribution

Big Idea

The BIG IDEA here is just that I can create a list of things I want to work on with my spare time and generate a random list of things to practice each day. The idea that it's randomized gives it a little more excitement for me and (I think) makes it easier for me to challenge myself to learn and grow.

@davidrichards
davidrichards / tmux.conf
Created October 14, 2015 19:26
TMUX Config
set -g prefix C-a
unbind C-b
bind C-a send-prefix
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
@davidrichards
davidrichards / fun_with_gaussians.py
Created September 21, 2015 23:44
Some Python code I did for a blog article.
import scipy.stats as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def z_score(x, m, s):
return (x - m) / s
def p(x, m, s):
z = z_score(x, m, s)
from bs4 import BeautifulSoup
from urllib import urlopen
import textmining
urls = [
'http://www.webmd.com/cancer/childhood-leukemia-symptoms-treatments',
'http://kidshealth.org/parent/medical/cancer/cancer_leukemia.html',
'http://www.nlm.nih.gov/medlineplus/childhoodleukemia.html'
]
U, s, V = np.linalg.svd(a, full_matrices=False)
U.shape, V.shape, s.shape
S = np.diag(s)
np.allclose(a, np.dot(U, np.dot(S, V)))
@davidrichards
davidrichards / superstatic.json
Created November 28, 2014 17:43
Permissive Superstatic Configuration
{
"root": "dist",
"clean_urls": true,
"error_page": "/index.html"
}
@davidrichards
davidrichards / gulpfile.js
Created November 28, 2014 17:07
Basic Gulpfile for a React.js + Reflux client application
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var cssMin = require('gulp-css');
var nodeunit = require('gulp-nodeunit');
gulp.task('cssMinfy', function(){
gulp.src('src/**/*.css')
.pipe(cssMin())
.pipe(gulp.dest('dist'));
@davidrichards
davidrichards / act
Last active August 29, 2015 14:08
I couldn't get a clean export. Probably there's some junk in there somewhere, or it's named funny, I don't know. act is a Reflux action. bare is a bare React component. com is a React component that uses Reflux. row is for a Zurb Foundation row in a React component (className instead of class). rr is just for requiring a file. sto is a Reflux da…
var React = require('react');
var Reflux = require('reflux');
var ${1:Noun}Actions = Reflux.createActions([
$0
]);
module.exports = $1Actions;
class CleanSubContractorContracts
def records
@records ||= SubContractorContract.includes(:contact).where("users.id IS NULL")
end
def no_user
@no_user ||= User.find_by_email('[email protected]')
end
@davidrichards
davidrichards / index.html
Last active August 29, 2015 14:04
Mobile-first concept
<html>
<head>
<script src="component_library.js" type="text/javascript">
<link rel="stylesheet" type="text/css" href="adaptive_styles.css">
</head>
<body>
<MainLayout src="pageflow.json">
<CoreConcept />
<MainNavigation location="bottom">