Skip to content

Instantly share code, notes, and snippets.

View kouphax's full-sized avatar

James Hughes kouphax

View GitHub Profile
trait HomingPigeonPowers {
val flyHome = (_:Any) => Results.Redirect(routes.Application.index())
}
@kouphax
kouphax / billyelliot.zsh-theme
Created November 7, 2013 13:33
Modified robbyrussel theme for oh-my-zsh
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=":$(git_prompt_short_sha)%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=":$(git_prompt_short_sha)%{$fg[blue]%})"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
@kouphax
kouphax / README.md
Last active December 20, 2015 19:19 — forked from mbostock/.block
Workflow Visualisation

Trying to design a visualisation for a linear flow

I am preparing a new video series that focuses on comparing and contrasting five technologies. This will be done over a number of episodes. However I am not sure of the overall format. Would you rather
1. Spend each episode on all the features of a single technology?
2. Spend each episode on looking at 1 or 2 features across all the technologies?
Thanks in advance
James
@kouphax
kouphax / Main.scala
Last active December 16, 2015 08:39
Basic Sample of how to avoid the now deprecated ServerConfig. `Main.scala` has all the stuff for running the app and `dev.scala` is the config you pass in.
package se.yobriefca
import com.twitter.ostrich.admin.{AdminServiceFactory, RuntimeEnvironment}
import com.twitter.finagle.builder.{ServerBuilder, Server}
import com.twitter.finagle.http.Http
import java.net.InetSocketAddress
import com.twitter.finagle.stats.OstrichStatsReceiver
import com.twitter.finagle.Service
import org.jboss.netty.handler.codec.http._
import com.twitter.util.{Eval, Config, Future}
public class Todo {
@JsonProperty
private long id;
@JsonProperty
@NotEmpty
private String title;
@JsonProperty
@kouphax
kouphax / Darcula.itermcolors
Created January 24, 2013 22:27
Jetbrains IntelliJ IDEA Darcula Theme ported to iTerm2 colour scheme. WIP.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.16300885379314423</real>
<key>Green Component</key>
<real>0.16304571926593781</real>
@kouphax
kouphax / dataflow.scala
Created January 8, 2013 19:30
Nice simple real-world example of how much clearer using Akkas DataFlow library is over using for comprehensions
// with Akkas DataFlow library
flow {
Ok(html.index(screencasts.all(), announcements.all()))
}
// with for comprehensions
for(
scs <- screencasts.all;
ann <- announcements.all
) yield Ok(html.index(scs, ann))
[error] /Users/kouphax/Projects/simplemachines/v1/admin/app/lib/FileStorage.scala:38: type mismatch;
[error] found : String
[error] required: play.api.libs.iteratee.Enumerator[Array[Byte]]
[error] Enumerator.fromFile(file).run(gridFS.save(filename, None, Option("image/png")))
[error] ^
[error] /Users/kouphax/Projects/simplemachines/v1/admin/app/lib/FileStorage.scala:38: type mismatch;
[error] found : None.type
[error] required: reactivemongo.api.gridfs.FileToSave[?]
[error] Enumerator.fromFile(file).run(gridFS.save(filename, None, Option("image/png")))
[error] ^
[error] /Users/kouphax/Projects/simplemachines/v1/admin/app/lib/FileStorage.scala:28: could not find implicit value for parameter readFileReader: reactivemongo.bson.handlers.BSONReader[T]
[error] gridFS.find(BSONDocument("filename" -> BSONString(filename))).headOption.map { existingFile =>
[error] ^
[error] /Users/kouphax/Projects/simplemachines/v1/admin/app/lib/FileStorage.scala:37: type mismatch;
[error] found : String
[error] required: play.api.libs.iteratee.Enumerator[Array[Byte]]
[error] Enumerator.fromFile(file).run(gridFS.save(filename, None, Option("image/png")))
[error] ^
[error] /Users/kouphax/Projects/simplemachines/v1/admin/app/lib/FileStorage.scala:37: type mismatch;
[error] found : None.type