ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
This file contains 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
withConnection :: (Connection -> IO c) -> ReaderT Config IO c | |
withConnection f = do | |
url <- connectionUrl | |
liftIO $ bracket (connectPostgreSQL url) (close) f | |
-- this should be pure! | |
connectionUrl :: ReaderT Config IO B.ByteString | |
connectionUrl = do | |
config <- ask | |
return $ BC.pack (url config) |
This file contains 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
connectionUrl :: Reader Config B.ByteString | |
-- withConnection | |
-- :: (Database.PostgreSQL.Simple.Internal.Connection -> IO c) | |
-- -> ReaderT Config Data.Functor.Identity.Identity (IO c) | |
withConnection f = do | |
url <- connectionUrl | |
return $ bracket (connectPostgreSQL url) (close) f |
This file contains 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
module AParser where | |
import Control.Applicative | |
import Data.Char | |
import Prelude as P | |
newtype Parser a = Parser { runParser :: String -> Maybe (a, String) } | |
satisfy :: (Char -> Bool) -> Parser Char |
This file contains 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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
ts: { | |
dev: { // a particular target | |
src: ["app/assets/javascripts/**/*.ts"], // The source typescript files, http://gruntjs.com/configuring-tasks#files | |
html: ["app/assets/templates/**/*.tpl.html"], // The source html files, https://github.com/basarat/grunt-ts#html-2-typescript-support | |
out: 'public/javascripts/app.js', // If specified, generate an out.js file which is the merged js file | |
watch: 'app/assets/javascripts', // If specified, watches this directory for changes, and re-runs the current target | |
reference: 'app/assets/javascripts/references.ts', | |
options: { // use to override the default options, http://gruntjs.com/configuring-tasks#options |
This file contains 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
# Clone rbenv into ~/.rbenv | |
git clone git@github.com:sstephenson/rbenv.git ~/.rbenv | |
# Add rbenv to your PATH | |
# NOTE: rbenv is *NOT* compatible with rvm, so you'll need to | |
# remove rvm from your profile if it's present. (This is because | |
# rvm overrides the `gem` command.) | |
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile | |
exec $SHELL |
This file contains 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 scala.slick.driver.PostgresDriver.simple._ | |
import scala.slick.session.{Database => SlickDatabase} | |
import Database.threadLocalSession | |
import scala.slick.jdbc.{GetResult, StaticQuery => Q} | |
import Q.interpolation | |
import scala.slick.lifted.CanBeQueryCondition | |
object SourcesTable extends Table[Source]("sources") { | |
def id = column[Long]("id", O.PrimaryKey, O.AutoInc) | |
def name = column[String]("name") |
This file contains 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
// simple example of the cake pattern | |
// abstract DAO trait | |
trait Repository[A, B]{ | |
// saves an entity, returns an ID | |
def save(entity: A): B | |
// more features.. | |
} | |
trait RdbmsRepository extends Repository[MyUserCaseClass, Long]{ |
This file contains 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 TypeSerializers { | |
implicit object LongPropertySerializer extends PropertySerializer[Long] { | |
def sqlType = "long" | |
} | |
implicit object StringPropertySerializer extends PropertySerializer[String] { | |
def sqlType = "string" | |
} | |
} |
This file contains 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
E/AndroidRuntime(30638): FATAL EXCEPTION: main | |
E/AndroidRuntime(30638): java.lang.NoSuchMethodError: scala.collection.immutable.StringLike.toString | |
E/AndroidRuntime(30638): at scala.collection.immutable.StringLike$class.toLong(StringLike.scala:230) | |
E/AndroidRuntime(30638): at scala.collection.immutable.StringOps.toLong(StringOps.scala:31) | |
E/AndroidRuntime(30638): at com.android.todoapp.Task$$anonfun$deserialize$1.apply(Task.scala:162) | |
E/AndroidRuntime(30638): at com.android.todoapp.Task$$anonfun$deserialize$1.apply(Task.scala:160) | |
E/AndroidRuntime(30638): at scala.collection.immutable.List.foreach(List.scala:309) | |
E/AndroidRuntime(30638): at com.android.todoapp.Task.deserialize(Task.scala:160) | |
E/AndroidRuntime(30638): at com.android.todoapp.Task$.deserialize(Task.scala:41) | |
E/AndroidRuntime(30638): at com.android.todoapp.Tasks$$anonfun$getTasks$1.apply(Tasks.scala:36) |