Skip to content

Instantly share code, notes, and snippets.

@stuwilli
stuwilli / standalone.xml
Created February 1, 2014 22:11
Jboss AS7 standalone config HS2 DB and JMS
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:1.2">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.clustering.jgroups"/>
<extension module="org.jboss.as.cmp"/>
<extension module="org.jboss.as.configadmin"/>
<extension module="org.jboss.as.connector"/>
# First add a rule for all local traffic to port 80 to go into pipe 1
# 100 is the rule number which will be used for referencing the rule later
sudo ipfw add 100 pipe 1 ip from 127.0.0.1 to 127.0.0.1 dst-port http
# To display the rule use
# sudo ipfw show 100
# configure the settings of the pipe as you please
# 50kbit/s bandwidth
sudo ipfw pipe 1 config bw 50Kbit
# 200ms lag
@stuwilli
stuwilli / pagination.tag
Last active August 29, 2015 13:57
Spring Data Pagination Taglib
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ attribute name="pg" type="org.springframework.data.domain.Page" required="true" rtexprvalue="true" description="The current Page" %>
<c:set var="showPages" value="10" />
<%-- No User Settings Below Here --%>
@stuwilli
stuwilli / 0_reuse_code.js
Created March 16, 2014 15:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@stuwilli
stuwilli / gist:04c0f3f35925e35bbf49
Last active August 29, 2015 14:10
Jenkins Post Build Script - Package
#!/bin/bash
WWW_PATH=/srv/www/public
DIST_DIR=./dist
RELEASE_DIR=$WWW_PATH/$JOB_NAME
RELEASE_NAME=$(echo $JOB_NAME | awk '{print tolower($0)}')
if [ ! -d "$RELEASE_DIR" ]; then
mkdir -p $RELEASE_DIR/testing
@stuwilli
stuwilli / gist:307b40d3e9605525e165
Last active August 29, 2015 14:10
Load external JS script
/**
* Import/include an additional script in the document head
* @param {string} src the source file
* @param {function} callback the callback function
*/
function importScript(src, callback) {
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', src);
@stuwilli
stuwilli / gist:0cc81d24f128d26fc3a8
Created December 9, 2014 15:21
js-beautify BBEdit Text Filter
#!/usr/local/bin/node
var beautify;
try {
beautify = require("/usr/local/lib/node_modules/js-beautify").js_beautify;
} catch(e) {
console.error("js-beautify is not found");
process.exit(e.code);
}
@stuwilli
stuwilli / brightcove-test.js
Created February 6, 2015 15:20
Test for existence of a Brightcove player
(function () {
if (typeof brightcove !== "undefined") {
if (Object.keys(brightcove.experiences).length !== 0) {
return true;
}
}
return false;
})();
@stuwilli
stuwilli / kickstart-fw-linktag.js
Last active August 29, 2015 14:20
Kickstart FW LinkTag From Head
(function() {
function kickStartLinkTag() {
if (typeof brightcove !== 'undefined') {
if (Object.keys(brightcove.experiences).length === 0) {
if (typeof AdOps !== 'undefined' && typeof AdOps.fw !== 'undefined') {
AdOps.fw.initLinkTag();
}
}
}
}
@stuwilli
stuwilli / ie-detect.js
Created May 6, 2015 12:48
IE Detection
function isIE () {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 0; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {