This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Will Fitzgerald
committed
Mar 5, 2012
0 parents
commit fdabf22
Showing
10 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'http://rubygems.org' | ||
gem 'rack' | ||
gem 'wordnik', '4.06.15' | ||
gem 'wordnik_ruby_helpers', '0.1.9' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
RedCloth (4.2.9) | ||
actionmailer (3.2.2) | ||
actionpack (= 3.2.2) | ||
mail (~> 2.4.0) | ||
actionpack (3.2.2) | ||
activemodel (= 3.2.2) | ||
activesupport (= 3.2.2) | ||
builder (~> 3.0.0) | ||
erubis (~> 2.7.0) | ||
journey (~> 1.0.1) | ||
rack (~> 1.4.0) | ||
rack-cache (~> 1.1) | ||
rack-test (~> 0.6.1) | ||
sprockets (~> 2.1.2) | ||
activemodel (3.2.2) | ||
activesupport (= 3.2.2) | ||
builder (~> 3.0.0) | ||
activerecord (3.2.2) | ||
activemodel (= 3.2.2) | ||
activesupport (= 3.2.2) | ||
arel (~> 3.0.2) | ||
tzinfo (~> 0.3.29) | ||
activeresource (3.2.2) | ||
activemodel (= 3.2.2) | ||
activesupport (= 3.2.2) | ||
activesupport (3.2.2) | ||
i18n (~> 0.6) | ||
multi_json (~> 1.0) | ||
addressable (2.2.7) | ||
arel (3.0.2) | ||
builder (3.0.0) | ||
erubis (2.7.0) | ||
hike (1.2.1) | ||
htmlentities (4.3.1) | ||
i18n (0.6.0) | ||
journey (1.0.3) | ||
json (1.6.5) | ||
mail (2.4.1) | ||
i18n (>= 0.4.0) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.17.2) | ||
multi_json (1.1.0) | ||
nokogiri (1.5.0) | ||
polyglot (0.3.3) | ||
rack (1.4.1) | ||
rack-cache (1.1) | ||
rack (>= 0.4) | ||
rack-ssl (1.3.2) | ||
rack | ||
rack-test (0.6.1) | ||
rack (>= 1.0) | ||
rails (3.2.2) | ||
actionmailer (= 3.2.2) | ||
actionpack (= 3.2.2) | ||
activerecord (= 3.2.2) | ||
activeresource (= 3.2.2) | ||
activesupport (= 3.2.2) | ||
bundler (~> 1.0) | ||
railties (= 3.2.2) | ||
railties (3.2.2) | ||
actionpack (= 3.2.2) | ||
activesupport (= 3.2.2) | ||
rack-ssl (~> 1.3.2) | ||
rake (>= 0.8.7) | ||
rdoc (~> 3.4) | ||
thor (~> 0.14.6) | ||
rake (0.9.2.2) | ||
rdoc (3.12) | ||
json (~> 1.4) | ||
sprockets (2.1.2) | ||
hike (~> 1.2) | ||
rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.0) | ||
thor (0.14.6) | ||
tilt (1.3.3) | ||
treetop (1.4.10) | ||
polyglot | ||
polyglot (>= 0.3.1) | ||
typhoeus (0.3.3) | ||
mime-types | ||
tzinfo (0.3.31) | ||
wordnik (4.06.15) | ||
activemodel (>= 3.0.3) | ||
addressable (>= 2.2.4) | ||
htmlentities (>= 4.2.4) | ||
json (>= 1.4.6) | ||
nokogiri (>= 1.4.4) | ||
typhoeus (>= 0.2.1) | ||
wordnik_ruby_helpers (0.1.9) | ||
RedCloth (>= 4.2.3) | ||
rails | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
rack | ||
wordnik (= 4.06.15) | ||
wordnik_ruby_helpers (= 0.1.9) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require './ikijibiki' | ||
run Sinatra::Application |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'wordnik' | ||
require 'sinatra' | ||
require 'sinatra/static_assets' | ||
require "sinatra/reloader" if development? | ||
|
||
Wordnik.configure do |config| | ||
config.api_key = ENV['WORDNIK_API_KEY'] | ||
end | ||
|
||
get "/" do | ||
@words = Wordnik.word.get_random_words("limit"=>50, "hasDictionaryDef" => true).map{|w| w["word"]} | ||
erb :index | ||
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
$(document).ready(function () { | ||
function addCommas(nStr) | ||
{ | ||
nStr += ''; | ||
x = nStr.split('.'); | ||
x1 = x[0]; | ||
x2 = x.length > 1 ? '.' + x[1] : ''; | ||
var rgx = /(\d+)(\d{3})/; | ||
while (rgx.test(x1)) { | ||
x1 = x1.replace(rgx, '$1' + ',' + '$2'); | ||
} | ||
return x1 + x2; | ||
} | ||
var sample_size = 50 | ||
var kwords = 636.357 | ||
|
||
$("#according").show(); | ||
|
||
$(".word").click(function () { | ||
// remove the current definition (if there) | ||
$("#definition").html('') | ||
|
||
// highlight it | ||
$(this).toggleClass("highlight"); | ||
// calculate size of vocabulary — note magic numbers | ||
var w = kwords * ($('.highlight').length / sample_size); | ||
w = Math.round(w)*1000 | ||
|
||
$('#wordcount').text(addCommas(w)); | ||
|
||
// declare intelligence... | ||
(w > 200000) ? $('#ikijibiki').text("You are a walking dictionary! an Ikijibiki!") : $('#ikijibiki').text('') | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
body { | ||
|
||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
color: black; | ||
word-wrap: break-word; | ||
padding: 3px; | ||
} | ||
|
||
p { | ||
margin: 4px; | ||
font-size:16px; | ||
} | ||
|
||
h1, h2, h3 { | ||
color: #1980D7; | ||
} | ||
#wordlist { | ||
margin: 20px; | ||
font-size:16px; | ||
font-weight:bolder; | ||
border-style: solid; | ||
border-width: 1px; | ||
border-color: #DDD; | ||
padding: 10px; | ||
} | ||
|
||
.word { | ||
color:#1980D7; | ||
cursor: pointer; | ||
} | ||
|
||
.expando { | ||
cursor: pointer; | ||
} | ||
|
||
.highlight { | ||
background:yellow; | ||
} | ||
|
||
#ikijibiki { | ||
font-weight: bold; | ||
} | ||
|
||
#wordcount { | ||
font-weight: bold; | ||
} | ||
|
||
.wn_small_heart { | ||
height: 15px; | ||
} | ||
#footer { | ||
|
||
border-top-width: 1px; | ||
border-top-style: solid; | ||
border-top-color: #DDD; | ||
} | ||
#according { | ||
display: none; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Ikijibiki</title> | ||
<%= stylesheet_link_tag "stylesheets/index.css", :media => "all" %> | ||
<%= javascript_include_tag "http://code.jquery.com/jquery-latest.js" %> | ||
<%= javascript_include_tag "javascripts/index.js" %> | ||
</head> | ||
<body> | ||
|
||
|
||
<div id="body"> | ||
<h1>Wordnik Ikijibiki</h1> | ||
<p>How many words do you know? Are you an <i>Ikijibiki</i>? At our latest count, Wordnik has 636,357 words with definitions. | ||
Scan the words below. Here's a random sample—if you know a word, click on it. You'll see a rough estimate of the | ||
total number of English words you know. (Click on the hearts to see the definitions.)</p> | ||
<div id="wordlist"> | ||
<% @words.each do |word| %> | ||
<span><span class="word"> <%= word %> </span> <a target='_new' href='http://wordnik.com/word/<%= word %>'> | ||
<%= image_tag("images/wordnik_heart.png", :class => "wn_small_heart") %></a> </span> | ||
<% end %> | ||
</div> | ||
<p id="according">According to what you've told me so far, you know about <span id="wordcount">0</span> words. <span id="ikijibiki"></p> | ||
<div id="definition" /> | ||
</div> | ||
<div id=footer> | ||
<%= image_tag ("images/wordnik_badge_a3.png") %> | ||
</div> | ||
</body> | ||
</html> |