Skip to content

Instantly share code, notes, and snippets.

@goofyahead
goofyahead / Place.js
Created September 15, 2016 14:53 — forked from PascalAnimateur/Place.js
Geospatial example in Sails.js using native MongoDB query
/* Place model */
module.exports = {
attributes: {
name: {
type: 'string',
required: true
},
@goofyahead
goofyahead / Jenkinsfile
Created May 27, 2019 09:40 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage c…
#!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
@goofyahead
goofyahead / Jenkinsfile.groovy
Created April 15, 2019 06:29 — forked from aerobless/Jenkinsfile.groovy
An example Jenkinsfile for a build pipeline using gradle, junit, selenium, checkstyle
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
}
@goofyahead
goofyahead / mono_sample.java
Last active October 23, 2018 06:49
Mono usage for coordinator spring boot sample
public class OrderHandlers {
private OrderService orderService;
private KitchenService kitchenService;
private DeliveryService deliveryService;
private AccountingService accountingService;
public OrderHandlers(OrderService orderService,
KitchenService kitchenService,
DeliveryService deliveryService,
AccountingService accountingService) {
this.orderService = orderService;
def androidExclusion = [
'**/databinding/**/*.*',
'**/android/databinding/*Binding.*',
'**/BR.*',
'**/R.*',
'**/R$*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*_MembersInjector.*',
'**/Dagger*Component.*',
sonarqube {
properties {
property "sonar.host.url", "http://localhost:9000/"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "myProject"
property "sonar.projectName", "myProject"
property "sonar.projectVersion", "V1.0"
property "sonar.sources", "src/main/java"
property "sonar.tests", ["src/test/java", "src/test/kotlin"]
property "sonar.java.coveragePlugin", "jacoco"
task codeCoverageReport(type: JacocoReport, dependsOn: 'testStagingDebugUnitTest') {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: 'build/intermediates/classes/staging/debug/com/yourpackage',
excludes: androidExclusion
@goofyahead
goofyahead / dependencies
Created June 26, 2018 09:45
jacoco report for android projects
apply plugin: 'org.sonarqube'
apply plugin: 'jacoco'
package com.example.tsl057.rxjavaplaygroundjava;
import android.util.Log;
import org.junit.Test;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
@goofyahead
goofyahead / gist:ea495ed9772f9b13a1988ba9fb1b061f
Last active April 4, 2018 10:12
prettify json response with curl
curl http://10.129.7.183:1337/jsonendpoint -H 'Authorization: XXXXX' | node <<< "var o = $(cat); console.log(JSON.stringify(o, null, 4));"