Skip to content

Instantly share code, notes, and snippets.

View saarons's full-sized avatar

Sam Aarons saarons

View GitHub Profile
@saarons
saarons / tiger_blood.rb
Created March 29, 2012 07:06
Win bets, lose sleep.
require "bigdecimal"
keywords = [
"abstract", "default", "if", "private", "throw", "boolean", "do",
"implements", "protected", "throws", "break", "double", "import",
"public", "transient", "byte", "else", "instanceof", "return", "try",
"case", "extends", "int", "short", "void", "catch", "final",
"interface", "static", "volatile", "char", "finally", "long", "super",
"while", "class", "float", "native", "switch", "true", "const", "for",
"new", "synchronized", "false", "null"
# Shamelessly ripped from http://fightingforalostcause.net/misc/2006/compare-email-regex.php
describe "The perfect email regex" do
before(:all) do
@regex = /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i
end
def matches(email)
!!email.match(@regex)
end
$(document).ready ->
gSmallShadow: new google.maps.MarkerImage("http://labs.google.com/ridefinder/images/mm_20_shadow.png", new google.maps.Size(22, 20), new google.maps.Point(0, 0), new google.maps.Point(6, 20))
gYellowIcon: new google.maps.MarkerImage("http://labs.google.com/ridefinder/images/mm_20_yellow.png", new google.maps.Size(12, 20), new google.maps.Point(0, 0), new google.maps.Point(6, 20))
places: {}
updatePlaces: ->
bounds: map.getBounds()
ne: bounds.getNorthEast()
sw: bounds.getSouthWest()
$.ajax({
---
party:
- name: Kyogre
moves: - Thunder
- Ice Beam
- Water Spout
- Calm Mind
item: Leftovers
- name: Rayquaza
(def earth-radius 6371)
(defn degree-to-radian [deg]
(* deg (/ Math/PI 180)))
(defn distance [lata lnga latb lngb]
(let [lata-r (degree-to-radian lata)
lnga-r (degree-to-radian lnga)
latb-r (degree-to-radian latb)
lngb-r (degree-to-radian lngb)