Skip to content

Instantly share code, notes, and snippets.

View rmanalan's full-sized avatar
:octocat:

Rich Manalang rmanalan

:octocat:
View GitHub Profile
@ryanbriones
ryanbriones / gist:240942
Created November 23, 2009 07:03
first pass at what my sinatra-like java servlet would look like
import org.sinatraLikeServlet.*;
public class MyApplication extends SinatraLikeHTTPServlet {
@get("/")
public void index(SinatraLikeHTTPServletRequest req
SinatraLikeHTTPServletResponse resp) {
MyResource[] resources = MyResource.findAll();
req.setAttribute("resources", resources);
}
@rjungemann
rjungemann / 1. restful_service.rb
Created June 2, 2010 01:51 — forked from headius/1. restful_service.rb
Sinatra-like example in JRuby with Jersey
require 'java'
java_import 'javax.ws.rs.Path'
java_import 'javax.ws.rs.GET'
java_import 'javax.ws.rs.Produces'
java_package 'com.headius.demo.jersey'
java_annotation 'Path("/helloworld")'
class HelloWorld
java_annotation 'GET'
java_annotation 'Produces("text/plain")'
@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'
@rmanalan
rmanalan / webcenter-chainable-json-api.js
Created September 30, 2010 16:40
Prototype WebCenter Chainable JSON API
var wc = {};
$.getJSON('http://wc/rest/api/resourceIndex',function(d){
wc = JSON.parse(d);
});
// based on @ded's async method chaining http://www.dustindiaz.com/async-method-queues/
// will initiate an async req to get the current user and lazily populates the currentUser
// object.
> wc.currentUser
[object currentUser]
@rmanalan
rmanalan / wc-rest-next.js
Created September 30, 2010 21:53
wc-rest.next.js
/*
* A more dynamic API for WebCenter
* Rich Manalang / @rmanalan
*
* This is an attempt to make a better Javascript wrapper for the WebCenter REST API.
* Goals:
* - Dynamic object creation
* - Callbacks receive proper objects from prior call
* - Concurrent request support
* - Beautiful API
@rmanalan
rmanalan / $w.js
Created October 5, 2010 23:51
Illustration of a jQuery like object
var $w = function(){
var $w = function(){
return new $w.init;
}
$w.prototype = {
// add all of the methods/props you want accessible as $w().method() or $w().prop here:
init: function(){
console.log('init called');
},
window.addEventListener "DOMContentLoaded", ->
body = $ "body"
canvas = $ "#canvas"
chalkboard = $ "#chalkboard"
close = $ "#close"
ledge = $ "#ledge"
lightswitch = $ "#lightswitch"
output = $ "#output"
shade = $ "#shade"
share = $ "#share"

Node Homework

If you do this, you are awesome.

  1. Update to node 0.4.0
  2. Go to https://github.com/ry/node/issues
  3. Pick a bug.
  4. Try to reproduce it.
  5. Comment with either:
  6. "works for me on 0.4.0"
@tekacs
tekacs / show
Created April 20, 2011 17:55
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
@matylla
matylla / nodeconf_2011.md
Created May 8, 2011 18:49 — forked from guybrush/nodeconf_2011.md
a list of slides from nodeconf 2011