Skip to content

Instantly share code, notes, and snippets.

View rmanalan's full-sized avatar
:octocat:

Rich Manalang rmanalan

:octocat:
View GitHub Profile

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"
@rmanalan
rmanalan / gitdeploy.md
Created December 9, 2010 20:13
My Git Deploy Workflow

My Git Deploy Workflow

I use this for static and simple [Sinatra][1] based sites -- great for prototyping simple apps. Credit goes to http://toroid.org/ams/git-website-howto for the original idea.

If you don't know what this is, here's an example of how I deploy my website/app to a server:

# create/update/delete files in my site
git add .
git commit -m "description of the changes I made"

git push

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

window.addEventListener "DOMContentLoaded", ->
body = $ "body"
canvas = $ "#canvas"
chalkboard = $ "#chalkboard"
close = $ "#close"
ledge = $ "#ledge"
lightswitch = $ "#lightswitch"
output = $ "#output"
shade = $ "#shade"
share = $ "#share"
@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');
},
@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 / 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 / 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'
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@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")'