Skip to content

Instantly share code, notes, and snippets.

View rmanalan's full-sized avatar
:octocat:

Rich Manalang rmanalan

:octocat:
View GitHub Profile
@rmanalan
rmanalan / packager.js
Created September 27, 2010 18:39
Psuedo code for a JS/CSS packager for static HTML apps
//manifest.js: defines the grouping of js/css
var $packager.assets = {
'app.js': [
{ name:'jquery.js', wait:true },
{ name:'sfasdf.js', wait:true },
{ name:'fasdt.js', wait:true }
],
'app.css': [
'blueprint.css',
'style.css'
// http://shouldersofgiants.co.uk/Blog/post/2009/08/17/Another-Cross-Domain-iFrame-Communication-Technique.aspx
// Forward message to the "real" iFrame that should be
// hosted somewhere in the parent page
function getFrame(name){
for(var i=0;i<parent.frames.length;i++) {
if (parent.frames[i].name == name) return parent.frames[i];
}
}
function ForwardMessage() {
@rmanalan
rmanalan / file.js
Created May 15, 2010 14:33 — forked from jlsync/file.js
$.sammy(function() {
app.get('#/exams/new', function(context) {
// display the modal
window.setTimeout( function(){
context.app.location_proxy.unbind();
context.app.setLocation('#/');
context.app.last_location = '#/';

mustache.vim

In your shell:

cd ~/.vim/syntax
wget http://github.com/defunkt/mustache/raw/master/contrib/mustache.vim

In your ~/.vim/filetype.vim:

runtime! ftdetect/*.vim

@rmanalan
rmanalan / .gems
Created January 25, 2010 20:54
Static websites using Heroku
rack-contrib
rack-rewrite

Rails 2.3.5 on App Engine (DataMapper)

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

The gems for the development environment include a pre-release appengine-tools gem that provides a pre-release version of jruby-rack.

sudo gem install google-appengine
@rmanalan
rmanalan / code.js
Created December 7, 2009 20:39
Failed test for Pure2
var bindData = {
'messages' : [
{
'id' : 1,
'avatar' : 'some avatar url',
'name' : 'some name',
'url' : 'some url',
'activity' : 'text',
'detail' : 'detailed text',
'reltime' : 'some date'
require 'java'
require 'atmosphere-spade-server.jar'
include_class 'javax.servlet.http.HttpServlet'
include_class 'org.atmosphere.cpr.AtmosphereHandler'
include_class 'org.atmosphere.grizzly.AtmosphereSpadeServer'
#setup and start the server
def main
AtmosphereSpadeServer.build("http://localhost:8080/").addAtmosphereHandler("", ChatPage.new()).addAtmosphereHandler("/chat-stream", ChatStream.new()).start
require 'java'
require 'atmosphere-spade-server.jar'
include_class 'javax.servlet.http.HttpServlet'
include_class 'org.atmosphere.cpr.AtmosphereHandler'
include_class 'org.atmosphere.grizzly.AtmosphereSpadeServer'
#setup and start the server
def main
AtmosphereSpadeServer.build("http://localhost:8080/").addAtmosphereHandler("", ChatPage.new()).addAtmosphereHandler("/chat-stream", ChatStream.new()).start
Declare Function PortalOpen PeopleCode FUNCLIB_PORTAL.PORTAL_GEN_FUNC FieldFormula;
Function GetListOfAvailablePageletsOnTab(&TabName As string) Returns JavaObject
&ap = CreateJavaObject("java.util.HashMap");
&Portal = PortalOpen();
&TabRef = &Portal.TabDefinitions.ItemByName(&TabName);
&AvailablePagelets = &TabRef.AvailablePagelets;
&Pagelet = &AvailablePagelets.First();
While &Pagelet <> Null;