Skip to content

Instantly share code, notes, and snippets.

View rgrove's full-sized avatar
🥧

Ryan Grove rgrove

🥧
View GitHub Profile
diff --git a/lib/innate/helper/link.rb b/lib/innate/helper/link.rb
index 08b8b2d..db0113b 100644
--- a/lib/innate/helper/link.rb
+++ b/lib/innate/helper/link.rb
@@ -28,12 +28,12 @@ module Innate
hashes, names = args.partition{|arg| arg.respond_to?(:merge!) }
hashes.each{|to_merge| hash.merge!(to_merge) }
+ escape = Rack::Utils.method(:escape)
location = route_location(self)
@rgrove
rgrove / gist:98356
Created April 20, 2009 04:09
Ramaze action cache vulnerable to collisions between controllers with identical method names
require 'rubygems'
require 'ramaze'
class MainController < Ramaze::Controller
map '/'
helper :cache
def index
%[
<html>
@rgrove
rgrove / test.txt
Created April 25, 2009 23:19
Impossible to route or rewrite requests for static files
It's not working.
$ 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.
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
module Thoth
class MainController
after(:index) do
@page = Page[:name => 'front']
@show_page_edit = true
end
end
end
@rgrove
rgrove / rc4.js
Created June 1, 2009 22:17
RC4-drop[256] (aka MARK-4) implementation in JavaScript. Minifies to 511 bytes using YUI Compressor.
/**
* RC4-drop[256] (aka MARK-4) implementation in JavaScript.
*
* @module rc4
*/
/**
* @class RC4
* @static
*/
<!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();
@rgrove
rgrove / history-lite.js
Created September 23, 2009 00:56
Lightweight Ajax browser history for YUI 3
/**
* 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
@rgrove
rgrove / storage.js
Created October 16, 2009 05:26
A persistent local key/value data store similar to HTML5's localStorage. Works in IE5+, Firefox 2+, Safari 3.1+, and any browser with Google Gears installed (including Chrome).
/**
* 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 () {