Skip to content

Instantly share code, notes, and snippets.

View mllrjb's full-sized avatar

Jason Miller mllrjb

View GitHub Profile
@mllrjb
mllrjb / README.md
Last active April 10, 2024 17:30
Jenkins init.groovy.d role-based authorization strategy

Usage

Set a system environment variable AUTHZ_JSON_URL that points to a JSON file with the following structure:

{
  "admins": [
    "groupA", 
    "userA"
 ],
@mllrjb
mllrjb / jdk-installers.groovy
Last active July 4, 2020 10:42
Jenkins init.groovy.d JDK Installer
import jenkins.model.*
import hudson.model.*
import hudson.tools.*
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("hudson.model.JDK")
def versions = [
"jdk8": "jdk-8u102-oth-JPR"
@mllrjb
mllrjb / readme.md
Last active May 29, 2019 21:03
JavaScript interview question (banana)

What does the following output?

# what will the following code output?

const arr = [5, 9, 4, 12];
for (var i = 0; i < arr.length; i++) {
  setTimeout(function() {
    console.log('Index: ' + i + ', element: ' + arr[i]);
 }, 3000);
@mllrjb
mllrjb / README.md
Last active February 14, 2019 14:15
Jenkins init.groovy.d LDAP Authentication

Usage

Set LDAP_BIND_USER and LDAP_BIND_PASSWORD environment variables in the system (e.g. when creating your Docker container, etc).

@mllrjb
mllrjb / nodejs-installers.groovy
Last active November 29, 2017 08:51
Jenkins init.groovy.d Nodejs installer script
import jenkins.model.*
import hudson.model.*
import jenkins.plugins.nodejs.tools.*
import hudson.tools.*
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("jenkins.plugins.nodejs.tools.NodeJSInstallation")
def versions = [
@mllrjb
mllrjb / _utility.border.scss
Created January 7, 2017 21:10
Sass border utility
/*
Borders
- - - - - - - - - - - - - - - - - - - - - - - - -
Helper classes for adding borders to elements
Class names follow this convention:
.[type][direction][size]
@mllrjb
mllrjb / _utility.spacing.scss
Created January 7, 2017 21:10
Sass padding and margin utilities
/*
Spacing
- - - - - - - - - - - - - - - - - - - - - - - - -
Helper classes for spacing like margin and padding.
Class names follow this convention:
.[type][direction][size]
@mllrjb
mllrjb / pipe.js
Created December 5, 2016 18:10
Piping Expressjs to another API via requestjs
'use strict';
const request = require('request');
module.exports = function forward(req, res, next) {
var myRequest = request({
url: req.url,
headers: req.headers
});
req.pipe(myRequest)
@mllrjb
mllrjb / migrate.js
Created December 5, 2016 18:03
Umzug Migration
const path = require('path')
, Umzug = require('umzug')
, Bluebird = require('bluebird')
const db = {
// sequelize instance
sequelize: null,
// Sequelize constructor
Sequelize: null
};
@mllrjb
mllrjb / Jenkinsfile
Created October 20, 2016 20:48
Jenkinsfile-kitchen-sink
#!groovy
/**
* Requires tool definitions for nodejs, jdk, maven, and ant
* Requires config files .npmrc and maven-settings.xml
*/
node() {
// checkout clean code
stage("checkout") {
checkout scm