Skip to content

Instantly share code, notes, and snippets.

View halfhp's full-sized avatar

Nick Fellows halfhp

View GitHub Profile
@halfhp
halfhp / circle.html
Created March 15, 2019 15:10
Use the circle API to get the link to the latest build for a given project / branch
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var url = new URL(window.location.href)
var user = url.searchParams.get("user")
var repo = url.searchParams.get("repo")
var branch = url.searchParams.get("branch")
var token = url.searchParams.get("token")
var circleUrl = "https://circleci.com/api/v1.1/project/github/" + user + "/" + repo + "/tree/" + branch + "?circle-token=" + token
@halfhp
halfhp / MyAppLoader.scala
Last active August 14, 2018 16:21
Play Framework Remote Configuration
package your.package
import scala.concurrent.duration._
import play.api.{ApplicationLoader, Configuration}
import play.api.inject.guice.{GuiceApplicationBuilder, GuiceApplicationLoader}
import scala.concurrent.{Await, Future}
class MyAppLoader extends GuiceApplicationLoader() {
@halfhp
halfhp / BusyLock.java
Last active October 13, 2016 22:11
Utility for preventing duplicate attempts to run background logic due to quickly pressing a button, etc.
/**
* Utility for preventing duplicate attempts to run background logic due to quickly pressing a button, etc.
* Similar to {@link Throttle} but automatically unlocks after callback completion instead of on throttle timeout ellapsing.
*
* Usage:
*
* BusyLock.obtain(new Callback() {
* public void run() {
* doSomethingInTheBackground();
* displayASuccessDialogOrWhatever();