High Heels From Hell Vs The Undead
Really liking this one…

“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it Currently working for GenieBelt who are based in Copenhagen, Denmark ...”
Really liking this one…

I just can’t find a way to stub out Facebooker::Service, this just didn’t seem to work.
fs = mock_model(Facebooker::Service, :post => "1")
Facebooker::Service.stub!(:new).and_return(fs)So finally I used.
describe FacebookPublisher do
class Facebooker::Service
def post(*args)
return "1"
end
end
it "just should ok" do
Facebooker::Session.create.<some method thingy>
end
end
I wanted to be able to send out a mail from a controller but also validate the incoming args in a clean way. Like so…
class MessagesController < ActionController::Base
def deliver
@message = Message.build(params[:message])
if @message.deliver
redirect_to home_path
else
render :action
end
endActionMailer::Base hides the initialize methods in method_missing and most of the time you are calling ActionMailer::Base.deliver_mymail(args). This allows you to specify all of the standard actionmailer settings in Message.build and return a Message object.
class Message < ActionMailer::Base
include Validatable
validates_presence_of :from, :body
def self.build(args = {})
new('default', args)
end
def self.action_mailer_methods
return [
:bcc,
:body,
:cc,
:charset,
:content_type,
:from,
:reply_to,
:headers,
:implicit_parts_order,
:mime_version,
:recipients,
:sent_on,
:subject,
:template
]
end
def default(args)
new_args = args.clone
new_args.each do |k,v|
if self.class.action_mailer_methods.include?(k)
send(k, new_args.delete(k))
end
end
if body.kind_of?(Hash)
@body.merge!(new_args)
end
end
def deliver
if self.valid?
return deliver!
else
return false
end
end
end
The Pandora…
…the most powerful gaming handheld there is….
Now, I’ll need some more freelance work to get my hands on one of these.
Found this ERB for jQuery script this morning from Dan Webb
// ERB style templates for jQuery in hardly any code.
//
// Based on http://ejohn.org/blog/javascript-micro-templating/
//
// A tiny and simple plugin to allow erb style template rendering within jQuery.
//
// Make a template:
//
// <script type="text/html" id="template1">
// <% $.each(items, function(i, image) { %>
// <p><img src="<%= image.media.m %>" alt="<%= image.title %>"></p>
// <% }); %>
// </script>
//
// Render the template into the dom with some data:
//
// <script type="text/javascript">
// jQuery(function($) {
// $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=jordan%20III&format=json&jsoncallback=?", function(data) {
// $('#test').render('template1', data);
// });
// });
// </script>
//
// Alternatively, you can load templates from files:
//
// $('#test').render('template.ejs', data);
jQuery(function($) {
var cache = {};
function compile(source) {
return new Function("obj",
"var p=[],print=function(){p.push.apply(p,arguments);};" +
"with(obj){p.push('" +
source
.replace(/[\r\t\n]/g, " ")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
.split("\t").join("');")
.split("%>").join("p.push('")
.split("\r").join("\\'")
+ "');}return p.join('');");
}
function load(template) {
if (!(/\W/).test(template)) {
return compile($("#" + template).html());
} else {
var source;
$.ajax({
async: false,
url: template,
dataType: 'text',
success: function(data) {
source = data;
}
});
return compile(source);
}
}
$.template = function(template, data) {
var fn = cache[template] = cache[template] || load(template);
if (data) return fn(data);
}
$.fn.render = function(str, data) {
return this.each(function() {
$(this).html($.template(str, data));
});
};
});
I found this little gem in a bog standard boring, run of the mill newsagents in Berlin, Zoologischer Garten. Perhaps Germany is more tech friendly but having monthly Ruby on Rails, PHP, .Net and Java monthlies is is quite crazy for what would be a small readership.

Available at http://it-republik.de/railsway/magazin-ausgaben/Ruby-on-Rails-000281.html
Nice little and verbose script to aid with the creation of remote git repos.
http://blog.carlmercier.com/2008/01/25/no-nonsense-git-part-1-git-remote-branch/
git-remote-branch create sv1.8or to track an already existing remote branch
git branch --track sv1.8 origin/sv1.8
Why does IE8 ignore this, grrrrrrrrr.
<!--[if lt IE 8]>
<script src="http://oursite.com/ie8.min.js" type="text/javascript"></script>
<![endif]-->It seems that the ie8.js script doesn’t like being used inside a frame.
http://dean.edwards.name/weblog/2008/01/ie7-2/
Hi dean,
First of all great work. I have a problem when I use your script inside a frame (ugly, I know). I get a permission denied on ‘if(/ie7_off/.test(top.location.search)||k<5)’.
Any thoughts on a quick fix?
Thanks, Ronald Moolenaar
I really do love the way you can add defaults in YAML
development: &defaults
consumer_key: randomzombieaction
consumer_secret: morerandomzombieaction
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults