Skip to content

Instantly share code, notes, and snippets.

View twasink's full-sized avatar

Robert Watkins twasink

View GitHub Profile
@twasink
twasink / Description
Created June 6, 2012 12:24
Spring, JPA, HSQLDB and automatically creating tables
Same as the earlier gist, but with JPA wrapping hibernate. Note that the choice of wether to create the tables or not is in the spring-config file, NOT the persistence.xml file like a lot of other examples out there.
@twasink
twasink / master_Dockerfile
Created August 1, 2016 02:13
A docker file for a Jenkins master server
FROM jenkins:2.7.1
MAINTAINER Robert Watkins
USER root
RUN mkdir /var/log/jenkins
RUN mkdir /var/cache/jenkins
RUN chown -R jenkins:jenkins /var/log/jenkins
RUN chown -R jenkins:jenkins /var/cache/jenkins
USER jenkins
data:
build: jenkins-data
master:
build: jenkins-master
volumes:
- .:/backup
volumes_from:
- data
ports:
@twasink
twasink / data_Dockerfile
Last active February 1, 2018 17:19
Dockerfile for a Jenkins data volume container
# Needs to match the linux version used in jenkins-master
FROM debian:jessie
MAINTAINER Robert Watkins
# user 1000 must match the user id for the jenkins user in jenkins-master
RUN useradd -d "/var/jenkins_home" -u 1000 -m -s /bin/bash jenkins
RUN mkdir -p /var/log/jenkins
RUN chown -R jenkins:jenkins /var/log/jenkins
FROM nginx:1.10
MAINTAINER Robert Watkins
RUN rm /etc/nginx/conf.d/default.conf
RUN rm /etc/nginx/nginx.conf
COPY conf/jenkins.conf /etc/nginx/conf.d/jenkins.conf
COPY conf/nginx.conf /etc/nginx/nginx.conf
@twasink
twasink / ClipboardOverride.js
Created September 21, 2016 01:54
An override to the default Grid Clipboard plugin for ExtJS, implementing somewhat more sensible behaviour
Ext.define('Twasink.override.Clipboard', {
override: 'Ext.grid.plugin.Clipboard',
// The default putCellData doesn't pay attention to the selection, or the editor. This is a fix
putCellData: function(data, format) {
var view = this.getCmp().getView();
// OVERRIDE Lines 141 to 157 in the ExtJS 6.2.0 source. This fixes a bug where the paste event starts where the
// navigation position is, which may well be at the bottom of the selection.
@twasink
twasink / HadoopMain.java
Created February 4, 2014 22:27
Example Hadoop Job that reads a cache file loaded from S3
// Based on http://pragmaticintegrator.wordpress.com/2013/08/16/writing-a-hadoop-mapreduce-task-in-java/
package net.twasink.hadoop;
import java.io.File;
import java.net.URI;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
#!groovy
node {
// Need to replace the '%2F' used by Jenkins to deal with / in the path (e.g. story/...)
// because tests that do getResource will escape the % again, and the test files can't be found.
// See https://issues.jenkins-ci.org/browse/JENKINS-34564 for more.
ws("workspace/${env.JOB_NAME}/${env.BRANCH_NAME}".replace('%2F', '_')) {
// Mark the code checkout 'stage'....
stage 'Checkout'
checkout scm
@twasink
twasink / build.gradle
Last active May 17, 2016 22:26
A skeleton for a gradle file to augment ExtJS's Sencha Cmd-generated build scripts. This particular one assumes the application is in a workspace.
ant.importBuild 'build.xml'
def packages_dir = file('../packages')
clean {
doLast { delete 'bootstrap.js', 'bootstrap.css', 'bootstrap.json' }
}
refresh {
inputs.dir 'app'
@twasink
twasink / 1_OverrideToHasOne.js
Last active December 17, 2015 21:49
The HasOne association in ExtJS needs some love - it would be nice if we could specify a 'name', which generates all of the necessary variables following a convention. This makes defining the association a lot less verbose Before and After examples are included.
// Apply an override to the HasOne association, allowing a 'name' parameter to generate the getter, setter, associationKey, and associatedName
Ext.override(Ext.data.association.HasOne, {
constructor: function(config) {
if (config.name ) {
Ext.applyIf(config, {
getterName: 'get' + Ext.String.capitalize(config.name),
setterName: 'set' + Ext.String.capitalize(config.name),
associationKey: config.name,
associatedName: config.name
})