Skip to content

Instantly share code, notes, and snippets.

@hdicksonjr
hdicksonjr / spell_checker.rb
Last active December 29, 2015 07:09
A command line spell-checker implemented as a bloom filter. The program is designed to map the dictionary in usr/share/dict on a unix system to a bit array by hashing it with MurmurHahsh3 when the program is started. The user is then prompted for input from the command line. That input is also run through the same hash function and the bit array…
require 'bitarray'
require 'murmurhash3'
class SpellCheckFilter
def initialize
@lines = File.readlines('/usr/share/dict/words')
@bit_array = BitArray.new(10000000)
end
def seed_bit_array
@hdicksonjr
hdicksonjr / carousel.js
Last active December 24, 2015 01:09 — forked from ksolo/carousel.js
Image Carousel
@hdicksonjr
hdicksonjr / form-validator.js
Last active December 24, 2015 00:40 — forked from ksolo/form-validator.js
Form Validation
// shorthand for $(document).ready();
$(function(){
$("#input").on("submit", function(event){
event.preventDefault();
var arrayfrominput = $(this).serializeArray();
var email_regex = new RegExp("[a-zA-Z]+[@]+[a-zA-Z]+[.]+[a-zA-z]")
if (!email_regex.test(arrayfrominput[0]["value"]))
alert("that email is bogus");
});
@hdicksonjr
hdicksonjr / index.html
Last active December 24, 2015 00:09 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>