This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Foo | |
case class Bar(x: Int) extends Foo | |
case class Baz(name: String) extends Foo | |
object Foo { | |
def show(f: Foo) = | |
f match { | |
case Bar(x) => x.toString // Quux, a subtype of Bar in a different file, will be matched as a Bar | |
case Baz(name) => name | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function copy_if_changed { | |
local path_from="$2/$1" | |
local path_to="$3/$1" | |
local md5_from=$(md5 -q $path_from) | |
if [ -e $path_to ] | |
then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unfiltered.response._ | |
import unfiltered.request._ | |
import unfiltered.filter._ | |
import unfiltered.directives._ | |
import Directive._ | |
import scala.concurrent.Future | |
import scala.util.Try | |
import javax.servlet.http.{HttpServletResponse, HttpServletRequest} | |
object AsyncDirective { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited | |
# | |
# Current known FCC address ranges: | |
# https://news.ycombinator.com/item?id=7716915 | |
# | |
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft | |
# | |
# In your nginx.conf: | |
location / { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Source files so we can announce stuff | |
. /mnt/apps/scripts/setenv.sh | |
. /mnt/apps/scripts/hipchat_notify.sh | |
if [ $(pidof -x deploy_if_new.sh | wc -w) -gt 2 ]; then | |
echo "$(date +"%Y-%m-%d %H:%M:%S %Z") Cowardly exiting as deploy_if_new is already running" | |
exit -1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the build file used to compile piday.scala | |
name := "piday" | |
scalaVersion := "2.10.3" | |
libraryDependencies += "org.spire-math" %% "spire" % "0.7.3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var attempts = 1; | |
function createWebSocket () { | |
var connection = new WebSocket(); | |
connection.onopen = function () { | |
// reset the tries back to 1 since we have a new connection opened. | |
attempts = 1; | |
// ...Your app's logic... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tapad.common.metrics | |
import java.net.Socket | |
import java.io._ | |
import com.tapad.common.log.Logging | |
import com.twitter.ostrich.stats._ | |
import java.util.TimerTask | |
object GraphiteReporter { | |
def apply(prefix: String, host: String, port: Int, reportInterval: Long) = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Welp { | |
def foobar(a: Int, b: Int, c:Int) { throw new IllegalArgumentException } | |
def main(args: Array[String]) { | |
List(3) map { | |
try { | |
foobar(1, 2, _) | |
} catch { | |
case e: Throwable => { // This set of braces is optional. Problem remains when removed. | |
println("won't be printed") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# ========================================================================= | |
# Copyright 2014 Rado Buransky, Dominion Marine Media | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |