Skip to content

Instantly share code, notes, and snippets.

@lstoll
lstoll / gist:1213260
Created September 13, 2011 06:33
Play framework pulling modules directly from GitHub
## Sadly this doesn't work yet, because the github zipball includes the content in a sub dir, rather than the root dir.
## So you end up with: ls modules/scala-0.9.1/lstoll-play-scala-6290346/
# Application dependencies
require:
- play
- play -> crud
# Version number can be a tag or a branch
- com.github.playframework -> scala 0.9.1
@lstoll
lstoll / JettyLauncher.scala
Created September 11, 2011 07:13
Scalatra on Heroku
/*
* Starts jetty for scalatra programatically
*
* Replace YourApplicationEndpointFilter with the filter in your application
*/
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler}
object JettyLauncher {
def main(args: Array[String]) {
@lstoll
lstoll / server.sh
Created August 23, 2011 12:40
hacky way to run and mange a bunch of processes
#!/bin/bash
old_mongo_pid=`ps auxww | grep mongod | egrep -v grep | awk '{print $2}'`
# Start mongo and memcache if not running
ps aux | grep mongod | grep -v grep || mongod &
#ps aux | grep memcached | grep -v grep || memcached & pids="$pids $!"
if [ "$old_mongo_pid" == "" ]
then
echo "mongo wasnt running"
sleep 1
@lstoll
lstoll / Gemfile
Created July 10, 2011 14:47
Fog storage example on Ninefold
source :rubygems
gem 'fog', :git => 'https://github.com/ninefold/fog.git', :branch => 'ninefold_storage'
#gem 'fog', :path => '/Users/lstoll/dev/ninefold/fog'
lstoll@linc ~ <master⚡> $ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *160.0 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS lincssd 159.7 GB disk0s2
3: Apple_Boot Boot OSX 134.2 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *640.1 GB disk1
hg_ps1() {
hg prompt "{ on {branch}}{ at {bookmark}}{status}{ ↑{outgoing}}{outgoing|count}{ ↓{incoming}}{incoming|count}" 2> /dev/null
}
function parse_git_branch {
#[ -d .git ] || return 1
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"

DON'T START A FLAME WAR OVER THIS

This is just an off the cuff hack at something I'm interested in. Don't take it seriously, we all know about benchmarking.

Testing with CouchDB 1.0, OS X 10.6.4, Intel X-25M SSD

The list and view are as simple as can be:

// List

function(head, req) {

def app
Rails::Application
end
gem 'compass', '0.10.2'
gem 'compass-960-plugin', :require => 'ninesixty'
gem 'haml', '3.0.10'
## Converts ObjectIds to Strings in a mongodb json dump. Can use this to convert for use in mongoid
require 'json'
def convert_id(item)
if id = item['_id']['$oid']
item['_id'] = id
end
end