Skip to content

Instantly share code, notes, and snippets.

View rgrove's full-sized avatar
🥧

Ryan Grove rgrove

🥧
View GitHub Profile
@rgrove
rgrove / gist:965702
Created May 11, 2011 00:51
Global YUI config
var YUI = require('yui3').YUI;
YUI.GlobalConfig = {
groups: {
yi: {
modules: {
"Yi.lang": {
fullpath: '/Volumes/Private/johnnyluu/Projects/yi/lib/lang.js'
},
"Yi.workflow": {
history : new Y.HistoryHash(),
COMPONENTS : {
PageContentInfo : {
requires : ['PageContentInfo'],
initializer : '_initPageContentInfo'
},
PageContentForum : {
@rgrove
rgrove / rakefile.rb
Created September 3, 2010 19:24 — forked from tivac/rakefile.rb
require 'yui-utils'
task :yui_modules do
output = YUIUtils.build_module_list()
#YUIUtils.output(modules)
end
@rgrove
rgrove / rakefile.rb
Created September 3, 2010 19:11 — forked from tivac/rakefile.rb
require 'yui-utils'
task :default, [:file, :replace, :filter, :jsdir] do |t, args|
args.with_defaults(
:filter => nil,
:jsdir => nil,
:replace => nil
)
modules = YUIUtils.build_module_list(args.filter, args.jsdir)
// Make an HTTP request to 'get.php'.
Y.io('get.php', {
on: {
complete: function (id, response) {
var id = id, // Transaction ID.
data = response.responseText; // Response data.
// ... handle the response ...
}
}
@rgrove
rgrove / gist:557733
Created August 30, 2010 17:31 — forked from ericf/gist:557658
<!DOCTYPE html>
<html>
<head>
<title>ValueChange Multiple Subscriptions</title>
</head>
<body>
<?php
$file = <<<EOF
attribute/tests/attribute.html
async-queue/tests/async-queue.html
cache/tests/cache.html
cache/tests/cacheoffline.html
classnamemanager/tests/classnamemanager.html
collection/tests/arraylist.html
collection/tests/collection.html
function buildQueryString(parameterMap) {
var params = [];
for (name in parameterMap) {
if (parameterMap.hasOwnProperty(name)) {
params.push(encodeURIComponent(name) + '=' + encodeURIComponent(parameterMap[name]));
}
}
return params.join('&');
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 = [];
@rgrove
rgrove / gist:282168
Created January 20, 2010 19:49 — forked from ahx/gist:281893
# 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'