Skip to content

Instantly share code, notes, and snippets.

View jpswain's full-sized avatar

Jamie Swain jpswain

View GitHub Profile
@jboner
jboner / Immutable domain model in Scala
Created August 24, 2009 15:06
Immutable Domain Model with JPA
// Sketch of an immutable domain model in Scala
// We used this scheme together with this JPA module:
// http://github.com/jboner/skalman/blob/d1e03a85be3964b9012f9e79dd726b0546342b2b/core/src/main/scala/JPA.scala
// ...and this GenericRepository:
// http://github.com/jboner/skalman/blob/d1e03a85be3964b9012f9e79dd726b0546342b2b/core/src/main/scala/GenericRepository.scala
abstract class Entity[T](val id: Int)
object User {
It is great to be able to run Linux on OSX in headless mode, this serves me very well because I have no choice but to use a Mac at work,
and there are many occasions where I need to have a Linux machine.
There are a couple reasons I don't like running virtual machines in regular mode.
1. It consumes way too much memory and CPU than I am willing to give up
2. It consumes way too much "attention" than I am willing ti give, for example, when you tab into your VM,
your mouse and keyboard gets captured and you have to hotkey out of it, it is just disruption to my work flow.
Headless mode comes in handy and solves the problems above because
1. It consumes about half of the memory and CPU because it does not handle monitor,
mouse and keyboard so the system resources are dedicated to the core functionality.
@matthewmccullough
matthewmccullough / .zshrc
Created January 20, 2011 00:00
A configuration to maintain history across sessions and share it across terminals in ZShell
##############################################################################
# History Configuration
##############################################################################
HISTSIZE=5000 #How many lines of history to keep in memory
HISTFILE=~/.zsh_history #Where to save history to disk
SAVEHIST=5000 #Number of history entries to save to disk
#HISTDUP=erase #Erase duplicates in the history file
setopt appendhistory #Append history to the history file (no overwriting)
setopt sharehistory #Share history across terminals
setopt incappendhistory #Immediately append to the history file, not just when a term is killed
@gertjana
gertjana / mapreduce_akka.scala
Created August 3, 2011 20:45
MapReduce example using Akka Actors
package net.addictivesoftware.scala.akkaactors
import akka.actor.{Actor, PoisonPill}
import Actor._
import akka.routing.{Routing, CyclicIterator}
import Routing._
import collection.mutable.{HashMap, Map}
import java.util.concurrent.CountDownLatch
import org.specs2._
import specification._
import matcher._
import lib.{OptionFormatter => OF}
import net.liftweb.common.Logger
import net.liftweb.mapper.Like
import model._
@paulmillr
paulmillr / dart.md
Last active January 7, 2025 21:10
Leaked internal google dart email

---------- Forwarded message ----------

From: Mark S. Miller <[email protected]>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: [email protected]
@seratch
seratch / build.sbt
Created December 1, 2011 06:07
Scala School - Testing with specs2 examples
organization := "net.seratch"
name := "sandbox"
version := "0.1"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq(
"junit" % "junit" % "4.9" withSources(),
@gabesumner
gabesumner / fiddle.css
Last active November 19, 2023 06:01
Address Validation using the Google Maps API
body {
font: 12px verdana;
background-color: #5C87B2;
}
form {
max-width: 400px;
padding: 15px;
background-color: white;
}
@heralight
heralight / WebSpec2.scala
Created March 29, 2012 08:43
lift:WebSpec2 + Unit test
package code.mockweb
/*
* Copyright 2011 WorldWide Conferencing, LLC
*
* 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
*
@hjr3
hjr3 / e-commerce.md
Created April 3, 2012 05:35
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links