Skip to content

Instantly share code, notes, and snippets.

View wsargent's full-sized avatar

Will Sargent wsargent

View GitHub Profile
@wsargent
wsargent / gist:655724
Created October 30, 2010 20:47
Want to do a callback
def setupMocks(onSubmitFunc(): => acm:ApplicationContextMock): Unit = {
val acm: ApplicationContextMock = new ApplicationContextMock
onSubmitFunc(acm)
tester = new WicketTester(new Application {
protected override def getSpringInjector: SpringComponentInjector = {
return new SpringComponentInjector(this, acm, true)
}
})
@wsargent
wsargent / building_base_vagrant_boxes.txt
Created October 3, 2011 07:44
Building a base vagrant box with RHEL / CentOS ISOs
[Provide gist to the building of base boxes below:]
http://vault.centos.org/4.0/isos/i386/
http://vault.centos.org/5.4/isos/x86_64/
http://vault.centos.org/5.1/isos/x86_64/
Vagrant documentation: http://vagrantup.com/docs/base_boxes.html
Building a base box: https://gist.github.com/354734
[Creating base boxes for RHEL 4 and RHEL 5 - 80 GB dynamic disks]
[Note that there is no easy way to change disk sizes - but you can add more]
@wsargent
wsargent / gist:1258640
Created October 3, 2011 07:46
Setting up a base vagrant box for Oracle
Install instructions for 10.2:
http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b15666/toc.htm
http://download.oracle.com/docs/cd/B19306_01/install.102/b15667/toc.htm
[Required files]
10201_database_linux_x86_64.cpio.gz
10201_companion_linux_x86_64.cpio.gz
p6810189_10204_Linux-x86-64.zip
@wsargent
wsargent / gist:1489171
Created December 17, 2011 04:24
Maven repositories suck.
[20:00:08] wsargent:framework git:(master*) $ ./build
Getting Scala 2.9.1 (for sbt)...
:: problems summary ::
:::: WARNINGS
module not found: org.fusesource.jansi#jansi;1.4
==== local: tried
/Users/wsargent/work/Play20/framework/./../repository/local/org.fusesource.jansi/jansi/1.4/ivys/ivy.xml
@wsargent
wsargent / gist:1492217
Created December 18, 2011 02:56
UNRESOLVED DEPENDENCIES
[18:55:51] wsargent:framework git:(master*) $ ./build
Getting Scala 2.9.1 (for sbt)...
:: problems summary ::
:::: WARNINGS
module not found: org.fusesource.jansi#jansi;1.4
==== local: tried
/Users/wsargent/work/Play20/framework/./../repository/local/org.fusesource.jansi/jansi/1.4/ivys/ivy.xml
@wsargent
wsargent / gist:1492419
Created December 18, 2011 04:59
results of package
[20:57:05] wsargent:Play20 git:(master) $ git submodule init
Submodule 'documentation/manual' (git@github.com:playframework/Play20.wiki.git) registered for path 'documentation/manual'
[20:57:08] wsargent:Play20 git:(master) $ git submodule update
Cloning into documentation/manual...
remote: Counting objects: 1995, done.
remote: Compressing objects: 100% (1824/1824), done.
remote: Total 1995 (delta 1350), reused 498 (delta 149)
Receiving objects: 100% (1995/1995), 1.50 MiB | 602 KiB/s, done.
Resolving deltas: 100% (1350/1350), done.
Submodule path 'documentation/manual': checked out '82c6d05375fad4c1afaccf259f22b964d3c25deb'
@wsargent
wsargent / JsonSpec.scala
Created December 19, 2011 00:20
Modified JsonSpec
package play.api.json
import org.specs2.mutable._
import play.api.json._
object JsonSpec extends Specification {
case class User(id: Long, name: String, friends: List[User], skills: Map[String, Int])
implicit object UserFormat extends Format[User] {
@wsargent
wsargent / export_wp.rb
Created February 13, 2012 06:11
Export typo comments to disqus using Nokogiri
# RAILS_ENV=production bundle exec rails runner ./script/wp_export.rb >! blog.wxr
# Require nokogiri in Gemfile here
site_link = "http://tersesystems.com/"
site_name = "Terse Systems"
builder = Nokogiri::XML::Builder.new do |xml|
xml.rss('version' => "2.0",
'xmlns:content' => "http://purl.org/rss/1.0/modules/content/",
'xmlns:wfw' => "http://wellformedweb.org/CommentAPI/",
@wsargent
wsargent / export_typo.rb
Created February 16, 2012 19:42
Exporting Typo to Disqus
# Require nokogiri in Gemfile here
site_link = "http://tersesystems.com/"
site_name = "Terse Systems"
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.rss('version' => "2.0",
'xmlns:content' => "http://purl.org/rss/1.0/modules/content/",
'xmlns:dsq' => "http://www.disqus.com/",
'xmlns:dc' => "http://purl.org/dc/elements/1.1/",
@wsargent
wsargent / ActionHandler.scala
Created July 7, 2012 21:52
ActionHandler for Remember Me cookie based authentication
/**
* Remember me cookie based authentication using Action Composition in Play 2.0.
*
* Code based on blog post from http://jaspan.com/improved_persistent_login_cookie_best_practice
*
* Create an object or class with this trait, and put it in your Global.onRouteRequest like so:
*
* <pre>
override def onRouteRequest(request: RequestHeader): Option[Handler] = {
super.onRouteRequest(request).map {