This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DistanceCalculator | |
#radians per degree | |
RAD_PER_DEG = 0.017453293 | |
#radius of the earth, in miles | |
Rmiles = 3956 | |
def self.get_distance(lat1, lon1, lat2, lon2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [ ~/Projects/nuklei/smoothiewizard/public/javascripts ] $ cdu 4 | |
# [ ~/Projects ] $ | |
function cdu { # "cd up" - move up $1 directories | |
if [ -z $1 ]; then | |
num=1 | |
else | |
num=$1 | |
fi | |
while [ $num -gt "0" ]; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include <ctype.h> | |
#include <stdio.h> | |
#define YYSTYPE double | |
%} | |
%token NUMBER | |
%left '+' '-' | |
%left '*' '/' | |
%left UNARYMINUS | |
%left UNARYPLUS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def getBookList(url: String): List[Book] = { | |
var books = List[Book](); | |
(ConstructingParser.fromSource(Source.fromURL(url), false) .document() | |
.docElem\\ "Item") | |
.foreach((item: Node) => { | |
books = new Book( | |
(item \ "ItemAttributes" \ "Title").text, | |
(item \ "ASIN").text | |
) :: books | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def page(query:String) = { | |
<html> <head> | |
<title>Book Search Results</title> | |
</head> | |
<body> | |
<h1>Book Search Results</h1> | |
<p> | |
You searched for | |
"<b>{ Text( query )}</b>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thinkminimo.booksearch; | |
import java.net._; | |
import scala.io._; | |
import scala.xml._ ; | |
import scala.xml.parsing._ ; | |
class AmazonResultPage { | |
val awskey = "02KVYA5XBEP8PMG4HAR2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'json' | |
class Person | |
attr_accessor :first, :last | |
def initialize(first, last) | |
@first = first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_json_encode: function(inVal, out) { | |
out = out || new Array(); | |
var undef; // undefined | |
switch (typeof inVal) { | |
case 'object': | |
if (!inVal) { | |
out.push('null'); | |
} else { | |
if (inVal.constructor == Array) { | |
var testVal = inVal.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tableize(wrapper, row, field, data, columns) { | |
return $("<"+wrapper+"/>").append( | |
A(data).map(function() { | |
var ret = $("<"+row+"/>"); | |
$.each($.map(this, function(prop) { | |
for(c in columns) { | |
if(columns[c] == prop) { | |
return prop; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tableize(data, selector) { | |
return $("<table/>").append( | |
A(data).find(selector).map(function() { | |
var ret = "<tr/>"; | |
$.each(this, function(k,v) { ret += "<td>"+v+"</td>" }); | |
return ret + "</tr>"; | |
}).get().join("") | |
); | |
} |
OlderNewer