Skip to content

Instantly share code, notes, and snippets.

View paulkoegel's full-sized avatar

Paul Kögel paulkoegel

View GitHub Profile
@paulkoegel
paulkoegel / gist:4566993
Created January 18, 2013 18:30
Synchronously load RequireJS-modularized QUnit tests and start QUnit afterwards This fixes an annoying issue with rerunning single QUnit tests. When loading tests asynchronously, single tests are identified by numerical IDs and since their order can change between reloads, you can't be sure you'll rerun the same test twice.
// author: Mathias Schäfer (@molily)
QUnit.config.autostart = false;
var modules = ['module_a', 'module_b'];
function loadNext () {
var module = modules.shift();
if (module) {
require([module], loadNext);
} else {
QUnit.start();
}
@paulkoegel
paulkoegel / subregions_idea.js
Created November 30, 2012 08:04
Is there a way to define Marionette subregions like this? Wouldn't this be cool?
// SCENARIO: i have an overview page with several regions.
// when clicking on an item, an overlay is opened (overview remains in the DOM).
// the overlay has several Marionette regions as well (article intro, article body,
// related articles, its own footer)
// QUESTION: wouldn't it be cool to render views by calling myApp.overlay.mainContent(new ArticleView())?
myApp.addRegions({
overview: {
el: '#overview',
$(function() {
var circle, circleLocation, circleOptions, cloudmade, cologne, map, marker, markerLocation;
map = new L.Map('map');
cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/3b477058df1d402fb1ea6f45611880e9/997/256/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
});
cologne = new L.LatLng(50.9293001, 6.9577079);
map.setView(cologne, 13).addLayer(cloudmade);
markerLocation = new L.LatLng(51.5, -0.09);
{
"y-u-no-http": "Tell us what's wrong with this request you just made =)",
"company": "Railslove GmbH",
"email": "[email protected]",
"pictures": "http://www.flickr.com/search/?q=railslove&s=rec&ss=1&z=e",
"office": "http://cowoco.de",
"locations": [
"Cologne, Germany",
"Hamburg, Germany"
@paulkoegel
paulkoegel / gist:1600009
Created January 12, 2012 11:35
Installing Postgres on OSX Lion for Rails 3.2
@paulkoegel
paulkoegel / gist:1408656
Created November 30, 2011 10:54
auto_link XML fuckup
- raise auto_link @text
"Winamp for Mac." Wait, what!? <a href="http://t.co/z7weqDII"{:xmlns=>"http://www.w3.org/1999/xhtml", "xml:lang"=<{:rel=>"nofollow", :class=<nil}, :lang=>{:rel=<"nofollow", :class=>nil}}<http://t.co/z7weqDII>/a<
not reproducible in console, where everything looks like it should:
ruby-1.9.3-p0 :001 > t = GridItem.tweets.any_in(:hashtags => ['sebastian_kippe']).first.text
=> "\"Winamp for Mac.\" Wait, what!? http://t.co/z7weqDII"
ruby-1.9.3-p0 :002 > helper.auto_link t
=> "\"Winamp for Mac.\" Wait, what!? <a href=\"http://t.co/z7weqDII\" rel=\"nofollow\">http://t.co/z7weqDII</a>"