Skip to content

Instantly share code, notes, and snippets.

View twasink's full-sized avatar

Robert Watkins twasink

View GitHub Profile
data:
build: jenkins-data
master:
build: jenkins-master
volumes:
- .:/backup
volumes_from:
- data
ports:
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 / 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
@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
@twasink
twasink / Example of Async
Last active August 29, 2015 14:08
Upgrade Jasmine 1.3 to Jasmine 2.0
Before
it("test stuff", function() {
...
waitsFor(function() {
return flag
}, "should set tthe flag, meaning its entered the callback", 150)
runs(function() {
controller.removeEvent(evt.id)
})
@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 / 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;
@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
})
@twasink
twasink / AssociativeReader.js
Created April 16, 2013 00:33
ExtJS has some really nice support out of the box for converting JSON data to model objects. However, it only supports array-based associations, and doesn't support maps/associative arrays. The AssociativeReader - included here, along with two demo models and sample data - provides a way to do that.
/**
* A variant of the JSON reader. Instead of reading arrays, where each record in the array field
* has an 'id' property, it reads objects - aka associative arrays. The key of the entry will be the
* array.
*
* So where the JSON reader would like data like this:
* [ { id: '1', property: 'foo' }, { id: '2', property: 'bar' } ]
*
* the associative reader likes data like this:
* { '1': { property: 'foo' }, '2': { property: 'bar' } }
@twasink
twasink / ControllerTestSpikeSpec.js
Created November 14, 2012 03:01
An example of testing an ExtJS controller and View together. (Not shown - the creation of the ExtJs application itself, or the Jasmine setup)
Ext.define('App.controller.SpikeController', {
extend: 'Ext.app.Controller',
refs: [
{ ref: 'foobar', selector: '#foobar' },
{ ref: 'bazbux', selector: '#bazbux' },
{ ref: 'spikeView', selector: 'spike_view' }
],
init: function() {