Skip to content

Instantly share code, notes, and snippets.

View jrheard's full-sized avatar
🛴

JR Heard jrheard

🛴
View GitHub Profile
// Welcome to Arduino!
// Here's a simple program to get you started driving your robot.
// We start by including the Servo library,
// which we'll be using to control the robot's wheels.
#include <Servo.h>
// Next, we declare a couple of Servo objects.
// Read on to see how these are actually used.
Servo servoLeft;
@jrheard
jrheard / password_checker_test.py
Created April 27, 2018 04:17
how to use hypothesis to generate "valid" passwords
import random
import string
from hypothesis import given
from hypothesis import settings
from hypothesis import strategies as st
import password_checker
(s/fdef draw-tiles
:args (s/cat :deck ::sp/deck
:hand ::sp/hand
:num-tiles (s/and nat-int? #(<= % MAX-HAND-SIZE)))
:ret (s/cat :new-deck ::sp/deck
:new-hand ::sp/hand))
(s/def ::cell (s/cat :x nat-int? :y nat-int?))
(s/def ::value (s/and nat-int? #(<= % 9)))
(s/def ::deck (s/coll-of ::value))
(s/def ::hand (s/coll-of ::value :min-count 0 :max-count 5))
(def cell-class (r/atom "red"))
(defn colorful-cell []
[:div.cell
{:class @cell-class
:on-click #(if (= @cell-class "red")
(reset! cell-class "green")
(reset! cell-class "red"))}
""])

Keybase proof

I hereby claim:

  • I am jrheard on github.
  • I am jrheard (https://keybase.io/jrheard) on keybase.
  • I have a public key whose fingerprint is 52CB 4C1F AB47 7FB7 BF8D 7C2F 560A 45C4 4A0F 1608

To claim this, I am signing this object:

@jrheard
jrheard / gist:1390621
Created November 24, 2011 04:32
fizzbuzz
for i in range(1, 100):
line = ""
if i % 3 == 0:
line += "Fizz"
if i % 5 == 0:
line += "Buzz"
if line == "":
line = str(i)