Skip to content

Instantly share code, notes, and snippets.

@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active April 22, 2024 11:24
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@koral--
koral-- / build.gradle
Last active December 12, 2017 01:31
testApt to testAnnotationProcessor migration, workaround for issue: https://code.google.com/p/android/issues/detail?id=224272
android.applicationVariants.all {
def aptOutputDir = new File(buildDir, "generated/source/apt/${it.unitTestVariant.dirName}")
it.unitTestVariant.addJavaSourceFoldersToModel(aptOutputDir)
}
@PascalAnimateur
PascalAnimateur / Place.js
Last active February 22, 2021 20:19
Geospatial example in Sails.js using native MongoDB query
/* Place model */
module.exports = {
attributes: {
name: {
type: 'string',
required: true
},
@berkkaraoglu
berkkaraoglu / BorderedCircleTransform.java
Created November 14, 2014 09:12
BorderedCircleTransform for Picasso (Based on https://gist.github.com/julianshen/5829333)
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
private final int BORDER_COLOR = Color.WHITE;
@chrisjhoughton
chrisjhoughton / bootstrap.js
Created August 14, 2014 10:56
SailsJS Geo-encoding and lookup
module.exports.bootstrap = function (cb) {
// Ensure we have 2dsphere index on Property so GeoSpatial queries can work!
sails.models.YOURMODEL.native(function (err, collection) {
collection.ensureIndex({ coordinates: '2dsphere' }, function () {
// It's very important to trigger this callack method when you are finished
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap)
cb();
@kellyfj
kellyfj / Gradle Android Jar Library
Last active November 8, 2019 20:33
Using the Android Library plugin for Gradle - create a .jar file (in addition to a .aar library file) that contains all the classes (and dependent jar files). Solution is based off a combination of solutions from https://gist.github.com/Lien/7150489 and the Winning answer to this Stackoverflow Question http://stackoverflow.com/questions/19307341…
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
@jonnyreeves
jonnyreeves / testrunner.html
Created June 2, 2012 13:32
Unit Testing Promises with Sinon.js
<!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>