Skip to content

Instantly share code, notes, and snippets.

View victusfate's full-sized avatar
🚀

Mark Essel victusfate

🚀
View GitHub Profile

Rails 2.3.5 on App Engine (DataMapper)

Do not use rvm (or install and run from JRuby). 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.5 calls to rubygems, and now we have it working. Rails 2.3.5 currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.

See the TinyDS version also: gist.github.com/269075

Install the Development Environment

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function(){
jQuery.noConflict();
var jq = jQuery;
jq.ajax({
url: '/rss',
type: 'GET',
dataType: 'xml',
error: function (xhr, status, e) {
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'digest/md5'
require 'fastercsv'
require 'json'
require 'curb'
require 'pp'
data = []
@victusfate
victusfate / webapp.rb
Created November 16, 2010 20:45 — forked from igrigorik/webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@victusfate
victusfate / webapp.py
Created November 16, 2010 20:51 — forked from alex/webapp.py
import traceback
class WebApp(object):
def __init__(self, obj):
self.obj = obj
def __call__(self, environ, start_response):
try:
path = filter(bool, environ["PATH_INFO"].split("/"))
@victusfate
victusfate / webapp.js
Created November 16, 2010 20:52 — forked from visnup/README.js
var connect = require('connect')
, sys = require('sys');
var webapp = function(req, res) {
var path = req.url.split('/');
this[path[1]].apply(this, path.slice(2));
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(sys.inspect(this));
};
require 'net/http'
require 'uri'
require 'nokogiri'
url = URI.parse('http://webapps.cityofchicago.org/healthinspection/inspectionresultrow.jsp')
request = Net::HTTP::Post.new(url.path)
request.set_form_data({"REST"=>" ", "STR_NBR"=>"", "STR_NBR2"=>"", "STR_DIRECTION"=>"", "STR_NM"=>"", "ZIP"=>""})
ruby-1.9.2-p0 > require 'postrank-api'
ruby-1.9.2-p0 > pr = PostRank::API.new('ig')
ruby-1.9.2-p0 > pr.feed(pr.feed_info('igvita.com')['id'], :num => 5)['items'].map {|i| i['content'].gsub(/<\/?[^>]*>/, "").summarize}
[
[0] "The world of concurrent computation is a complicated one. Hence, not surprisingly, when Bruce Tate asked Matz, in an interview for his recent book (Seven Languages in Seven Weeks) for a feature that he would like to change in Ruby if he could go back in time, the answer was telling: \xE2\x80\x9CI would remove the thread and add actors or some other more advanced concurrency features\xE2\x80\x9D.\nProcess Calculi & Advanced Concurrency\nIt is easy to read a lot into Matz's statement, but the follow-up question is: more advanced concurrency features? Process calculi is the formal name for the study of many related approaches of modeling the behavior of concurrent systems, which provides many alternatives: CCS, CSP, ACP, and Actor models just to name a few.\nActors, CSP and Pi-calculus\n
javascript: (function () {
var n = null,
C = false;
function h(m) {
d(m, "jsgif_overlaid");
m.removeEventListener("click", i, C)
}
function i(m) {
var o = this;