Skip to content

Instantly share code, notes, and snippets.

View pledbrook's full-sized avatar

Peter Ledbrook pledbrook

View GitHub Profile
@pledbrook
pledbrook / XComDownloadableContentInfo_RevivalProtocolFixes.uc
Created December 1, 2019 09:03
Fix for fully removing stun effect via Revival protocol (Revival Protocol Fixes mod)
//---------------------------------------------------------------------------------------
// FILE: XComDownloadableContentInfo_RevivalProtocolFixes.uc
//
// Use the X2DownloadableContentInfo class to specify unique mod behavior when the
// player creates a new campaign or loads a saved game.
//
//---------------------------------------------------------------------------------------
// Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------
@pledbrook
pledbrook / checkUrlLinks.groovy
Created July 30, 2018 07:20
Utility scripts for transforming old Gradle user manual `api:...` links to the current `link:...` ones and for verifying the validity of links in the resulting HTML

Groovy Podcast Ep. 6 Show Notes

  • Groovy 2.4.0 was released during the last episode of the the podcast.

    • Android support built-in + a Gradle plugin
    • Methods moved from Collection to Iterable + some other methods added, such as size()
    • groovysh getting some love
  • Gradle 2.3 RC2 was released yesterday

    • Improved Gradle Build Comparison plugin
  • Better Eclipse WTP integration

@pledbrook
pledbrook / gist:9e1e6e0e1a520b6a3612
Created June 26, 2014 10:09
Trying to redirect all paths below a given prefix (GET only)
ratpack {
...
handlers {
get {
...
}
prefix("blog") {
handler {
redirect 303, "http://blog.cacoethes.co.uk/${get(PathBinding).pastBinding}"
@pledbrook
pledbrook / gist:5858308
Created June 25, 2013 13:10
The dependency blocks in your Grails project's BuildConfig.groovy required to `maven-deploy` to [Bintray](http://www.bintray.com). The key is to exclude `wagon-http-lightweight` and include `wagon-http` instead.
dependencies {
build "org.apache.maven.wagon:wagon-http:2.4"
}
plugins {
build ":release:2.2.0", ":rest-client-builder:1.0.3", {
export = false
exclude "wagon-http-lightweight"
}
}
// Grails 2.0.4
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
@pledbrook
pledbrook / BuildConfig.groovy
Created October 19, 2012 13:37
Base Grails 1.3.3 dependency configuration for new plugin repository
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
@pledbrook
pledbrook / ApplicationConfig.java
Created August 21, 2012 14:43
Environment-specific cache managers in Spring
package org.example.config;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager
@Configuration
public class ApplicationConfig {
@Bean public ConcurrentMapCacheManager cacheManager() {
return new ConcurrentMapCacheManager();
}
}
package todosample
import grails.events.Listener
class DebugService {
@Listener
def packageWarStart() {
println "[DebugService] Packaging started"
}
@pledbrook
pledbrook / Config.groovy
Created May 16, 2012 10:17
Loading runtime config from JSON in Grails
// ... rest of Config.groovy content goes above this line to ensure that
// the JSON overrides existing settings.
ConfigLoader.addEntries(loadJson(fetchJson()), this)
def fetchJson() { return System.getenv("GRAILS_APP_CONFIG") }
def loadJson(content) { return content ? grails.converters.JSON.parse(content) : [:] }