Skip to content

Instantly share code, notes, and snippets.

View quitschibo's full-sized avatar

Manuel Möhlmann quitschibo

  • CodeFarm GmbH
  • Hamburg, Germany
View GitHub Profile
@quitschibo
quitschibo / mocha_coveralls_reporter_makefile
Created June 1, 2014 16:42
A make command for running mocha tests and report results to coveralls
# run tests and calculate coverage with coveralls
test:
@./node_modules/.bin/mocha
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

Hot Swapping With Maven, Jetty and IntelliJ

Based on Configuring Jetty, Maven, and Eclipse together with Hot Swap

I've always been a bit jealous when it comes to the Play! framework and the great dev mode they have for hot swapping classes at runtime. Jetty has a configuration setting, scanIntervalSeconds, that mimics this when working with a more traditional WAR, but does so by looking for changes to a file and restarting the server.

Fortunately, Jetty also provides the ability to rapidly test code with hot swapping. No more server restarts. The trick to getting hot swapping to work is to attach a remote debugger to your Jetty process. The following instructions outline how to do this in IntelliJ (tested with IDEA 10.5 CE).

Modify your jetty-maven-plugin to ignore the scan interval

  1. Open your pom and locate the plugins section
@quitschibo
quitschibo / testMocks.js
Last active July 21, 2023 17:25
How to mock jQuery calls with Jasmine. Just some examples ;)
describe('Mock jQuery calls with Jasmine', function() {
it('how to mock $("test").show()', function() {
// mock the call
spyOn($.fn, 'show').andCallFake(function() {
return true;
});
// now we can call the mock
result = $("test").show();