Skip to content

Instantly share code, notes, and snippets.

View sofoklis's full-sized avatar

Sofoklis Papasofokli sofoklis

View GitHub Profile
resolvers += Classpaths.typesafeResolver
addSbtPlugin("com.typesafe.sbteclipse" %% "sbteclipse-plugin" % "2.0.0-M3")
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))
@sofoklis
sofoklis / gist:1716041
Created February 1, 2012 09:00
build.sbt for lift
// need this if you want to browse code
EclipseKeys.withSource := true
version := "1.0"
scalaVersion := "2.9.1"
name := "Test sbt"
liftVersion := "2.4"
@sofoklis
sofoklis / Build.scala
Created February 1, 2012 09:34
Adding keys for sbt in project/Build.scala
val liftVersion = SettingKey[String]("lift-version")
val jettyVersion = SettingKey[String]("jetty-version")
@sofoklis
sofoklis / gist:1729878
Created February 3, 2012 12:13
jquery ajax
$.ajax({
url: "test.html",
success: function(){
$(this).addClass("done");
}
});
@sofoklis
sofoklis / gist:1730594
Created February 3, 2012 15:05
lift ajax basics
import net.liftweb.http._
import S._
import js._
import JsCmds._
import JE._
import net.liftweb.util._
import Helpers._
import scala.xml.Text
class AjaxCall {
@sofoklis
sofoklis / gist:1730616
Created February 3, 2012 15:10
html template
<div class="lift:surround?with=default;at=content">
<b>Ajax Example</b>
<br />
<div class="lift:ajaxCall.sample">
<div id="script"></div>
<textarea id="ajax_question" rows="8" cols="50"></textarea>
<br />
<button id="button">Click Me</button>
</div>
</div>
@sofoklis
sofoklis / gist:1747029
Created February 5, 2012 18:24
jQuery autocomplete
$( "#city" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
@sofoklis
sofoklis / gist:1766968
Created February 8, 2012 08:54
lift json autocomplete html
<div class="lift:surround?with=default;at=content">
<div class="lift:jsonAutocomplete">
<script id="script"></script>
<div class="demo">
<div class="ui-widget">
<label for="city">Your city: </label>
<input id="city" />
</div>
</div>
</div>
@sofoklis
sofoklis / gist:1766971
Created February 8, 2012 08:55
lift json autocomplete snippet
import net.liftweb.http._
import S._
import js._
import JsCmds._
import JE._
import net.liftweb.textile._
import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import scala.xml._
@sofoklis
sofoklis / gist:1992310
Created March 7, 2012 09:56
scala regular expressions example
case class Line(id : Long, yesNo : Boolean, name : String, optional : Option[String], amount : Double)
object SimpleImport {
// Create the field regex so you can compose them
//and be able to simply extract the information
val sourceFolder : String = "/home/sofoklis/Desktop"
val digit = """~(\d*)~"""
val double = """([-+]?[\d]*\.?[\d]+)*"""
val text = """~([^~]*)~"""
val separator = """\^"""