Skip to content

Instantly share code, notes, and snippets.

package com.example.tests;
import com.example.tests.config.TestDatabaseConfig;
import org.flywaydb.core.Flyway;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.context.annotation.PropertySource;
coderatchet / after--example_goog.object.extend_config_defaults.js
Last active Sep 8, 2016
default values for keys in a configuration object for a function using goog.object.extend()
View after--example_goog.object.extend_config_defaults.js
* @typedef {{
* exportFormat: string,
* renderFormat: string,
* exportArguments: Array }}
* @param {some.namespace.MyClass.ARGUMENTS=} opt_config optional configuration object
coderatchet /
Created Sep 8, 2016
Turn off code formatting for code block in Intellij Idea
# open intellij settings
# Editor -> Code Style -> (in context window) Formatter Control -> tick "Enable formatter markers in comments"
# @formatter:off
(r"/api/myapp/([0-9]+)/module/(some|uberlly|rediculouslly|long|line|of|code|that-will-probably|be-auto-formatted|into-multiple|lines|but|I've|arranged|like|this|intentionally)/datboi/export", my.awesome.over.80.line.Class)
# @formatter:on
coderatchet / mod_wsgi-POST-example-environ-variable-contents.txt
Created Aug 25, 2016
Example environ variable contents of mod_wsgi apache server POST method (sanitized for public viewing)
View mod_wsgi-POST-example-environ-variable-contents.txt
# example of the contents of the environ variable that is passed to wsgi application callables. i.e. __call__(environ, reponse)
{'mod_wsgi.listener_port': '9999'
'HTTP_REFERER': 'http://localhost:1234/app'
'beaker.get_session': <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x105da2190>>
'HTTP_ACCEPT_LANGUAGE': 'en-AU,en;q=0.8'
'CONTEXT_DOCUMENT_ROOT': '/.../myapp/conf/.mod_wsgi-express/api/htdocs'
coderatchet /
Last active Aug 17, 2016
bash completion for virtual environments (virtualenv) in mac os x
export VENVS=$HOME/venvs # or whatever your virtualenvs folder is.
# first install brew_completion by calling `brew install brew-completion`
# will add bash_completion in the future. for now this is a place holder for when it will be needed.
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
# if you're placing the _act function and its alias in their corresponding files
if [ -f $HOME/.bash_functions ]; then
coderatchet / goog-events-eventtype-beforeunload-tabclose.html
Last active Aug 15, 2016 Intercepting a tab close using the 'beforeunload' event.
View goog-events-eventtype-beforeunload-tabclose.html
<!doctype html>
<html lang="en">
<title>BEFOREUNLOAD intercept example</title>
<h1>Try to close me!</h1>
<form action="javascript:console.log('stop poking me!');">
<label for="something">sometimes you need to interact with the page before the browser will prompt you.</label><input type="text" id="something" />
<input type="submit" />
coderatchet / goog-debouncer-usage.js
Last active Aug 14, 2016
goog.async.Debouncer usage
View goog-debouncer-usage.js
//after a little messing around, I found out how to use the goog.async.Debouncer properly
var usernameField_ = /* something like a textfield */
var thingThatShouldHappenOnceAfterInterval = function(){ /* ... */ }
var inputHandler = new;
var eventHandler_ = /* @type */
/* where the magic happens */
You can’t perform that action at this time.