This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
import groovy.json.JsonOutput | |
import groovy.json.JsonSlurper | |
def label = "mypod-${UUID.randomUUID().toString()}" | |
podTemplate(label: label, yaml: """ | |
spec: | |
containers: | |
- name: mvn | |
image: maven:3.3.9-jdk-8-alpine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent { | |
label 'agentId' //The id of the slave/agent where the build should be executed, if it doesn't matter use "agent any" instead. | |
} | |
triggers { | |
cron('H */8 * * *') //regular builds | |
pollSCM('* * * * *') //polling for changes, here once a minute | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> | |
<!-- when.js Promises implementation --> | |
<script src="https://raw.github.com/cujojs/when/master/when.js"></script> | |
<!-- Unit testing and mocking framework --> | |
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class HttpInterceptor implements Interceptor { | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
Request request = chain.request(); | |
//Build new request | |
Request.Builder builder = request.newBuilder(); | |
builder.header("Accept", "application/json"); //if necessary, say to consume JSON | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Place model */ | |
module.exports = { | |
attributes: { | |
name: { | |
type: 'string', | |
required: true | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BitmapScaler | |
{ | |
// scale and keep aspect ratio | |
public static Bitmap scaleToFitWidth(Bitmap b, int width) | |
{ | |
float factor = width / (float) b.getWidth(); | |
return Bitmap.createScaledBitmap(b, width, (int) (b.getHeight() * factor), true); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.libraryVariants.all { variant -> | |
def name = variant.buildType.name | |
if (name.equals(com.android.builder.BuilderConstants.DEBUG)) { | |
return; // Skip debug builds. | |
} | |
def task = project.tasks.create "jar${name.capitalize()}", Jar | |
task.dependsOn variant.javaCompile | |
//Include Java classes | |
task.from variant.javaCompile.destinationDir | |
//Include dependent jars with some exceptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Generic enabled Object Oriented Switch/Case construct | |
* @param <T> type to switch on | |
*/ | |
public class Switch<T extends Comparable<T>> | |
{ | |
private final List<Case<T>> cases; |