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
$ ruby route_test.rb | |
W [2009-04-25 23:49:56 $27423] WARN | : No explicit root folder found, assuming it is . | |
D [2009-04-25 23:49:56 $27423] DEBUG | : Using webrick | |
I [2009-04-25 23:49:56 $27423] INFO | : WEBrick 1.3.1 | |
I [2009-04-25 23:49:56 $27423] INFO | : ruby 1.8.6 (2008-03-03) [universal-darwin9.0] | |
D [2009-04-25 23:49:56 $27423] DEBUG | : TCPServer.new(0.0.0.0, 7000) | |
D [2009-04-25 23:49:56 $27423] DEBUG | : Rack::Handler::WEBrick is mounted on /. | |
I [2009-04-25 23:49:56 $27423] INFO | : WEBrick::HTTPServer#start: pid=27423 port=7000 | |
D [2009-04-25 23:50:05 $27423] DEBUG | : accept: 127.0.0.1:57986 | |
D [2009-04-25 23:50:05 $27423] DEBUG | : Rack::Handler::WEBrick is invoked. |
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
YAHOO.namespace('util').HTML = (function () { | |
var d = document, | |
Y = YAHOO, | |
isArray = Y.lang.isArray, | |
isObject = Y.lang.isObject, | |
isString = Y.lang.isString, | |
ATTRIBUTES = !d.documentElement.hasAttribute ? { | |
// IE < 8 |
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
module Thoth | |
class MainController | |
after(:index) do | |
@page = Page[:name => 'front'] | |
@show_page_edit = true | |
end | |
end | |
end |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
// Shaving off even more characters, because I can | |
function L(U,C){var d=document,f='firstChild',r='readyState',h=d.documentElement[f],s=d.createElement('script'),m=s[r]?'onreadystatechange':0;s.src=U;s[m||'onload']=function(){if(!m||/ded|te/.test(s[r])){s[m]=null;C()}};h.insertBefore(s,h[f]);} | |
// async loading of javascript files, starting asap. | |
L("http://example.com/example.js",function () { | |
doSomething(); |
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
/** | |
* The History Lite utility is similar in purpose to the YUI Browser History | |
* utility, but with a more flexible API, no initialization or markup | |
* requirements, limited IE6/7 support, and a much smaller footprint. | |
* | |
* @module history-lite | |
*/ | |
/** | |
* @class HistoryLite |
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
/** | |
* Implements a persistent local key/value data store similar to HTML5's | |
* localStorage. Should work in IE5+, Firefox 2+, Safari 3.1+, and any browser | |
* with Google Gears installed (including Chrome). Doesn't work in Opera. | |
* | |
* @module storage | |
* @namespace YAHOO.Search | |
* @requires yahoo, event, json | |
*/ | |
(function () { |
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
# remove content of script tags using Sanitize | |
require 'sanitize' | |
html = '<p>Do not<script>fail();</script> kill the <a href="/cats/42">cat</a>.</p>' | |
Sanitize.clean(html, Sanitize::Config::BASIC.merge( | |
:transformers => lambda { |env| | |
node = env[:node] | |
if node.name.downcase == 'script' |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'mechanize' | |
URL_LOGIN = 'https://login.comcast.net/login?continue=https://login.comcast.net/account' | |
URL_USERS = 'https://customer.comcast.com/Secure/Users.aspx' | |
abort "Usage: #{$0} <username> <password>" unless ARGV.length == 2 |
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
var count = 10, | |
http = require("http"), | |
sys = require("sys"), | |
twitter = http.createClient(80, "search.twitter.com"), | |
i, request; | |
for (i = 1; i <= count; i++) { | |
request = twitter.request("GET", "/search.json?q=crockfordfact+OR+crockfordfacts&rpp=100&page=" + i, {"host": "search.twitter.com"}); | |
request.addListener('response', function (response) { | |
var responseData = []; |
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 buildQueryString(parameterMap) { | |
var params = []; | |
for (name in parameterMap) { | |
if (parameterMap.hasOwnProperty(name)) { | |
params.push(encodeURIComponent(name) + '=' + encodeURIComponent(parameterMap[name])); | |
} | |
} | |
return params.join('&'); |