Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Sargent wsargent

View GitHub Profile
@wsargent
wsargent / gist:655724
Created Oct 30, 2010
Want to do a callback
View gist:655724
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 Oct 3, 2011
Building a base vagrant box with RHEL / CentOS ISOs
View building_base_vagrant_boxes.txt
[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 Oct 3, 2011
Setting up a base vagrant box for Oracle
View gist:1258640
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 Dec 17, 2011
Maven repositories suck.
View gist:1489171
[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 Dec 18, 2011
UNRESOLVED DEPENDENCIES
View gist:1492217
[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 Dec 18, 2011
results of package
View gist:1492419
[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 Dec 19, 2011
Modified JsonSpec
View JsonSpec.scala
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 Feb 13, 2012
Export typo comments to disqus using Nokogiri
View export_wp.rb
# 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 Feb 16, 2012
Exporting Typo to Disqus
View export_typo.rb
# 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 Jul 7, 2012
ActionHandler for Remember Me cookie based authentication
View ActionHandler.scala
/**
* 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 {
You can’t perform that action at this time.