Skip to content

Instantly share code, notes, and snippets.

View sethmcl's full-sized avatar

Seth McLaughlin sethmcl

  • Dropbox
  • San Francisco, CA
View GitHub Profile
@sethmcl
sethmcl / json_jx2j
Created May 27, 2012 12:35
JSON output from jtd-xml-to-json
{
"testsuite": {
"name": "Firefox_3617_Linux.ShowMoreTest",
"errors": "0",
"failures": "1",
"tests": "6",
"time": "0.009000001"
},
"tests": [
{
@sethmcl
sethmcl / XML jx2j
Created May 27, 2012 12:42
XML input for jtd-xml-to-json
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="Firefox_3617_Linux.ShowMoreTest" errors="0" failures="1" tests="6" time="0.009000001">
<testcase classname="Firefox_3617_Linux.ShowMoreTest" name="testCharCount" time="0.0010"/>
<testcase classname="Firefox_3617_Linux.ShowMoreTest" name="testLinkAdded" time="0.0010">
<failure type="failed" message="[{&quot;message&quot;:&quot;The \&quot;Show More\&quot; text was not added to the show more link expected \&quot;Show More1\&quot; but was \&quot;Show More\&quot;&quot;,&quot;name&quot;:&quot;AssertError&quot;,&quot;fileName&quot;:&quot;http://localhost:9876/static/runner.js&quot;,&quot;lineNumber&quot;:356,&quot;stack&quot;:&quot;Error(\&quot;The \\\&quot;Show More\\\&quot; text was not added to the show more link expected \\\&quot;Show More1\\\&quot; but was \\\&quot;Show More\\\&quot;\&quot;)@:0\nfail(\&quot;The \\\&quot;Show More\\\&quot; text was not added to the show more link expected \\\&quot;Show More1\\\&quot; but was \\\&quot;Show More\\\&quot;\&quo
@sethmcl
sethmcl / notifyit_pub_route.js
Created May 28, 2012 14:29
Dynamic express route in NotifyIt app
app.post('/pub/:channel/:eventName', function(request, response) {
var data = request.body, // Body of the POST request
channel = request.params.channel, // Value of channel, ex: "myapp"
eventName = request.params.eventName; // Value of eventName, ex: "load"
// do stuff
});
@sethmcl
sethmcl / notifyit_pub_event.js
Created May 28, 2012 14:39
cURL command to publish event with NotifyIt
$ curl http://localhost:2012/pub/chatapp/new-user -d "{\"name\":\"Seth\"}" -H "Content-Type:application/json"
@sethmcl
sethmcl / install_venus.sh
Last active December 10, 2015 13:08
Install Venus with NPM
npm install -g venus
@sethmcl
sethmcl / venus_annotations.js
Created January 2, 2013 21:57
Simple example of using Venus annotations
/**
* @venus-library mocha
* @venus-include ../src/Greeter.js
*/
describe('Greeter', function() {
it('.talk() should format string', function() {
var greet = new Greeter(),
result = greet.talk('Hello %s, how are you doing this fine %s?', 'Seth', 'Thursday');
@sethmcl
sethmcl / mincer.js
Created December 23, 2013 23:48
Using mincer to serve assets
// Dependencies
var mincer = require('mincer'),
path = require('path'),
connect = require('connect'),
http = require('http');
// Globals
var environment,
app;
@sethmcl
sethmcl / tags_helper.rb
Created December 23, 2013 23:53
Helper for using mincer in rails
module TagsHelper
def speedy_stylesheet(path)
if Rails.application.config.use_mincer == true
return raw("<link rel=\"stylesheet\" type=\"text/css\" href=\"http://#{ENV['BOWIE_HOST']}:3001/assets/#{path}\">")
else
return stylesheet_link_tag(path, :media => "all")
end
end
end
@sethmcl
sethmcl / bus.js
Last active January 4, 2016 15:39
// EventBus.js
// Creating the Event Bus object is easy, because we can simply extend the Backbone.Events object
var eventBus = {};
_.extend(eventBus, Backbone.Events);
// Note: in a real application, you would want to place your eventBus object within a namespace, to avoid polluting the global namespace in your application.
// ViewE.js
eventBus.trigger('item-selected', { itemId: id });