This file contains hidden or 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
<h1>JavaScript Snow</h1> |
This file contains hidden or 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
<!-- This goes under your link menu if you have one --> | |
<h1>Some Javascript Tricks</h1> | |
Name: <input id="name" type="text" onkeyup="document.getElementById('response').innerHTML = 'Hi, ' + this.value + '. I hope you enjoy this.';"> | |
<br> | |
Color: <input id="color" type="text" onkeyup="document.body.style.backgroundColor=this.value;"> | |
<p id="response"></p> |
This file contains hidden or 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
var saveTheirSouls = function() { | |
$('img').trigger('mouseover'); | |
setTimeout( function() { | |
if ($('img').length > 1) { | |
return saveTheirSouls() | |
} | |
else { | |
return false; | |
} |
This file contains hidden or 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
#!/usr/bin/ruby | |
puts "Enter phrase. 60 characters or less." | |
phrase = gets.chomp | |
words = phrase.downcase.gsub(/[^a-z ]/, "").split(" ") | |
word_count = words.length | |
word_lengths = [] | |
words.each { |word| word_lengths << word.length } |
This file contains hidden or 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
# config.ru | |
app = proc do |env| | |
[ 200, {'Content-Type' => 'text/html'}, "hello world" ] | |
end | |
run app | |
# coolio_config.rb | |
require 'cool.io' |
This file contains hidden or 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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'sinatra' | |
require 'cool.io' | |
#config | |
ADDR = '127.0.0.1' | |
PORT = 4321 | |
Do not use rvm (or install and run from JåRuby). The google-appengine gem must install into your system MRI. The appengine-sdk gem includes a complete Java app server. We bootstrap Java from MRI, then your app runs inside a servlet container (with access to all the APIs) using the version of JRuby installed into each app.
We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.x calls to rubygems, and now we have it working. Rails 2.3.x currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.
See the TInyDS version also: gist.github.com/gists/269075