Skip to content

Instantly share code, notes, and snippets.

View estsauver's full-sized avatar

Earl St Sauver estsauver

View GitHub Profile
(ns blog.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(enable-console-print!)
(def post1 {:title "Learn Clojurescript from Scratch"
/* See license.txt for terms of usage */ .firebugCanvas { position:fixed; top: 0; left: 0; display:none; border: 0 none; margin: 0; padding: 0; outline: 0; } .firebugCanvas:before, .firebugCanvas:after { content: ""; } .firebugHighlight { z-index: 2147483646; position: fixed; background-color: #3875d7; margin: 0; padding: 0; outline: 0; border: 0 none; } .firebugHighlight:before, .firebugHighlight:after { content: ""; } .firebugLayoutBoxParent { z-index: 2147483646; position: fixed; background-color: transparent; border-top: 0 none; border-right: 1px dashed #E00 !important; border-bottom: 1px dashed #E00 !important; border-left: 0 none; margin: 0; padding: 0; outline: 0; } .firebugRuler { position: absolute; margin: 0; padding: 0; outline: 0; border: 0 none; } .firebugRuler:before, .firebugRuler:after { content: ""; } .firebugRulerH { top: -15px; left: 0; width
@estsauver
estsauver / keybase.md
Created December 12, 2014 05:46
keybase.md

Keybase proof

I hereby claim:

  • I am estsauver on github.
  • I am estsauver (https://keybase.io/estsauver) on keybase.
  • I have a public key whose fingerprint is 3916 1459 3D61 A943 C2CB 2439 A36A 2675 02DD A09A

To claim this, I am signing this object:

enum ParseResult<T> {
Success(T),
Failure,
Error
}
impl <T> ParseResult<T> {
fn map<U, F: Fn(T) -> U>(&self, f: F) -> ParseResult<U> {
match *self {
ParseResult::Success(t) => ParseResult::Success(f(t)),
@estsauver
estsauver / keybase.md
Created January 23, 2015 21:28
keybase.md

Keybase proof

I hereby claim:

  • I am estsauver on github.
  • I am estsauver (https://keybase.io/estsauver) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

What's it like?
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.1
Comment: https://keybase.io/crypto
wcBMA0LRcvxegGy/AQgAmHK4gXwl9GeGz4jRRqpH7Uy1MGnQ6rsUyay+l4txkrnE
6LkKPWfmXYx1Gppxe+06maz3ZzmT9IGwXE/cnKTYae6X48F/glu4Y75zRKuKSDLz
lCzwJxpy5o6Qwb7vIyZvJpRRf+qMJkRLZcYlw4G2q2YY9KoKv39SNsMnVoWDmmk3
9oOUo52sb3PzKnlAR1nteZmRsi2l1QToVSV//UqXXAGRA/Zxs9xlizy+r5UnQ5Tz
EsmfMaLRwH8rOILPPMV0Ku0JcH1ci7R4aCW8YZfYe7mVkMr4sMITZ1/6YnrAKgW+
vcpa0n0aIgrIWnwb0wIKEt5UTS6K7Dh0ZYrLt0pA+MHBTAOg4xJfZjLE6gEP/3i5
@estsauver
estsauver / error.markdown
Created February 8, 2015 04:22
Function Implementation

I'm writing a parser combinator library. I thought maybe I could also make the parser structs functions that operate on input, but I can't get the types right. The offending code.

Earls-MacBook-Pro:farce earljstsauver$ head 10 src/parser.rs 
head: 10: No such file or directory
==> src/parser.rs <==
pub trait Parser<'b>: Fn(&str, Option<&str>) {
}


impl &lt;'a&gt; Fn(&amp;str, Option&lt;&amp;str&gt;) for LiteralParser&lt;'a&gt; {
@estsauver
estsauver / whoisScript.rb
Last active December 14, 2015 15:49
Whois script for getting university names from domains
require 'whois'
def getUniversitys(domainNameArray)
#DomainNameArray should be in the form host.edu/host.com/host.whatever.
# i.e. tufts.edu, harvard.edu, etc., not http://tufts.edu
w = Whois::Client.new
domainNameArray.each do |domain|
r = w.query(domain)
puts r.registrant_contact[:organization]
@estsauver
estsauver / sillygame.rb
Created March 18, 2013 17:19
Silly Game simulator
require 'active_support/core_ext/enumerable.rb'
def game
playing = true
board = (1..12).to_a
while playing do
diceroll = [Random.rand(6)+1, Random.rand(6)+1]
play = earlStrategy(board, diceroll) || []
playing = checkPlay(play,board,diceroll)
# puts "Board was #{board}"
# puts "Roll was #{diceroll}"