Skip to content

Instantly share code, notes, and snippets.

View collinvandyck's full-sized avatar
🏠
Working from home

Collin Van Dyck collinvandyck

🏠
Working from home
  • Rippling
  • Durham, NC
View GitHub Profile
import util.matching.Regex
class KillsScala2.8.1 {
val ErrorR = new Regex("\\[ERROR\\](.*)")
val LogR = new Regex("\\[LOG\\](.*)")
val SuspendedUserR = new Regex("\\[SUSPENDED_USER\\](.*)")
val CreatedUserR = new Regex("\\[CREATED_USER\\](.*)")
val NumUsersProcessedR = new Regex("\\[NUM_USERS_PROCESSED\\](.*)")
val NumUsersPendingR = new Regex("\\[NUM_USERS_PENDING\\](.*)")
import java.util.concurrent.BlockingQueue
import collection.JavaConversions
object Drainer {
def drain[T](queue: BlockingQueue[T], max: Option[Int] = None) : Seq[T] = {
val arrayList = new java.util.ArrayList[T]
queue.drainTo(arrayList, max.getOrElse(queue.size()))
JavaConversions.JListWrapper(arrayList)
}
#!/usr/bin/env ruby
require 'benchmark'
def permute(chars)
if chars.length <= 1
[chars]
else
result = []
chars.each_with_index do |char, idx|
@collinvandyck
collinvandyck / gist:3420791
Created August 22, 2012 00:23
More responsive dock behavior in OS X
defaults write com.apple.Dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.50
killall Dock
package main
import (
"database/sql"
"fmt"
"time"
)
type User struct {
Id string
package main
import (
"database/sql"
"fmt"
"time"
)
type User struct {
Id string
package main
import (
"fmt"
"net/http"
)
func main() {
fmt.Printf("Starting HTTP server...\n")
http.HandleFunc("/authenticate", Authenticate)
val record : Option[Thing] = lookForThing()
record.foreach(r => r.doSomething())
public class AuthConfiguration extends Configuration {
@Valid
@NotNull
@JsonProperty
private DatabaseConfiguration database = new DatabaseConfiguration();
public DatabaseConfiguration getDatabaseConfiguration() {
return database;
}
database:
driverClass: org.postgresql.Driver
user: postgres
password: postgres
url: jdbc:postgresql://localhost/authdb
properties:
charSet: UTF-8
maxWaitForConnection: 1s
validationQuery: "/* MyService Health Check */ SELECT 1"
minSize: 8