This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('ngFocus', ['$parse', function($parse) { | |
return function(scope, element, attr) { | |
var fn = $parse(attr['ngFocus']); | |
element.bind('focus', function(event) { | |
scope.$apply(function() { | |
fn(scope, {$event:event}); | |
}); | |
}); | |
} | |
}]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Perform HTTP POST to the given URL using selenium. Put this in actions.js. | |
// Works with selenese: | post | http://url-to-http-post-to.com/ | | |
Selenium.prototype.doPost = function(url) { | |
var form = this.getCurrentWindow().document.createElement('form'); | |
form.id = 'formAddedBySeleniumDoPost'; | |
form.method = 'POST'; | |
form.action = url; | |
var body = this.browserbot.findElement("css=body"); | |
if (typeof body == "undefined") { | |
throw new SeleniumError("No body element to append form element to for performing POST to url '" + url + "'"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your local ~/.ssh/config to be prompted for password only once for multiple terminals | |
ControlMaster auto | |
ControlPath /tmp/ssh_mux_%h_%p_%r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# restart will start thin without error even when it is not already running. | |
echo "Usage: ./script/thin start|stop|restart" | |
# Log and pid file names will include port number before the .log/.pid extension. | |
bundle exec thin --pid tmp/pids/thin.pid --servers 1 --daemonize --log log/thin.log --port 3000 $1 | |
bundle exec thin --pid tmp/pids/thin.pid --servers 1 --daemonize --log log/thin.log --port 3001 --ssl $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put me in grails-app/conf/DebugFilters.groovy | |
class DebugFilters { | |
def filters = { | |
all(controller:'*', action:'*') { | |
before = { | |
log.error "${request.method}: $request.forwardURI $request.params" | |
} | |
after = { Map model -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jetbootlabs.services | |
/* | |
* Truncates H2 tables mapped by the domainClasses variable. Useful for cleaning up test data. | |
* | |
* Temporarily disables referential integrity to avoid constraint violation errors when | |
* deleting records. | |
* | |
* Inspired by Luke Daley's blog post on how to do this in MySQL: | |
* http://ldaley.com/post/398082618/brute-force-fixture-cleanup-in-grails |
NewerOlder