Skip to content

Instantly share code, notes, and snippets.

View MrJaba's full-sized avatar

Tom Crinson MrJaba

View GitHub Profile
@MrJaba
MrJaba / rubinius
Created December 14, 2010 10:04
Rubinius SHA1 issue
tcrins01@AM2201:~ $ rvm list rubies
rvm rubies
rbx-1.1.0-20100923 [ i386 ]
rbx-1.1.1-20101116 [ i386 ]
rbx-head [ i386 ]
ruby-1.8.7-p249 [ i386 ]
ruby-1.9.2-p0 [ i386 ]
@MrJaba
MrJaba / gist:725172
Created December 2, 2010 11:50
Rack Media Type
Rack::Mime::MIME_TYPES.merge!(".ttf"=>"application/octet-stream", ".woff" =>"application/octet-stream")
@MrJaba
MrJaba / gist:725170
Created December 2, 2010 11:48
Padrino Media Type Error
RuntimeError: Unknown media type: ".ttf"
/Library/Ruby/Gems/1.8/gems/sinatra-1.1.0/lib/sinatra/base.rb:133:in `content_type'
/Library/Ruby/Gems/1.8/gems/padrino-core-0.9.19/lib/padrino-core/application/routing.rb:578:in `content_type'
/Library/Ruby/Gems/1.8/gems/padrino-core-0.9.19/lib/padrino-core/application/rendering.rb:88:in `content_type'
/Library/Ruby/Gems/1.8/gems/sinatra-1.1.0/lib/sinatra/base.rb:156:in `send_file'
/Library/Ruby/Gems/1.8/gems/padrino-core-0.9.19/lib/padrino-core/application/routing.rb:560:in `static!'
Issues Fixed:
#505,#507,#504,#506,#502,#503,#500,#501,#490,#499,#498,#496,#492,#495,#476,#478,#481,#479,#469,#461,#464,#455,#462,#462,#454,#460,#460,#459,#459,#455,#457,#458
Commits:
e6934f6 Fixed pack to taint output for tainted directives string.
b822da5 Specs for unpack output tainted if directive is tainted.
75bdbc5 Added configure option to specify 'rake' command. The value can be set via --rake option to the configure script
or by setting the RAKE environment variable.
a = [1,2,3, "Cheddar", {:cheese => "awesome"}]
a.grep(String)
#=> ["Cheddar"]
a.grep(Hash)
#=> [{:cheese=>"awesome"}]
var sys = require('sys'),
fs = require('fs'),
Url = require('url'),
http = require('http'),
querystring = require('querystring');
require('./mustache');
var html_template = "<html><head><title>{{title}}</title></head><body>{{{content}}}</body></html>";
var form = function() {return "<div id='container'> \
var sys = require('sys'),
http = require('http'),
require('./mustache'); //require with ./ as it's in local directory
//Set up a template to render HTML with {{title}} is a tag which gets replaced with content
//{{{content}}} is another tag which gets replaced. The triple moustache (curly brace) means don't escape HTML
var html_template = "<html><head><title>{{title}}</title></head><body>{{{content}}}</body></html>";
//Setup a basic form so we can post some data to the node server \'s are there to do multiline strings in Javascript
//Later on this can be hidden away in another file to make the code look prettier
var sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
//Add a listener to the request for the request body data
var thing = null;
req.addListener('data', function(data){
thing = data.toString();
//These are required node library files to assist us.
var sys = require('sys'),
http = require('http');
//http is the http library
//so on every request the given function will be called with a request and a response argument.
http.createServer(function (req, res) {
//write out the response headers
res.writeHead(200, {'Content-Type': 'text/html'});
//finish it up with what you want to send to the client
context "Context name" do
setup do
#init stuff here
end
should "test name/behaviour" do
get :blah, :param_1 => 'a', :param_2 => 'b'
puts @response.body
assert_select "blah"
end
end