This file contains hidden or 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
private lazy val b_not_factor: Parser[Boolean] = opt("not") ~ b_factor ^^ (x ⇒ x match { case Some(v) ~ f ⇒ !f; case None ~ f ⇒ f }) |
This file contains hidden or 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
package org.papasofokli | |
import scala.util.parsing.combinator.JavaTokenParsers | |
/** | |
* <b-expression>::= <b-term> [<orop> <b-term>]* | |
* <b-term> ::= <not-factor> [AND <not-factor>]* | |
* <not-factor> ::= [NOT] <b-factor> | |
* <b-factor> ::= <b-literal> | <b-variable> | (<b-expression>) | |
*/ |
This file contains hidden or 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
lines.foreach(line ⇒ line match { | |
case RegEx(id, yesNo, name, optional, amount) ⇒ println(Line(id.toLong, | |
booleanFromString(yesNo).get, | |
name, optionString(optional), amount.toDouble)) | |
case _ ⇒ println("Something Wrong!") | |
}) |
This file contains hidden or 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
~01001~^~Y~^~some text1~^~~^1.38 | |
~01002~^~N~^~some text2~^~~^2.38 | |
~01003~^~Y~^~some text3~^~full test~^3.38 | |
~01004~^~N~^~some text4~^~~^4.38 | |
~01005~^~Y~^~some text5~^~dddd~^5.38 | |
~01006~^~N~^~some text6~^~~^6.38 | |
~01007~^~Y~^~some text7~^~~^7.38 | |
~01008~^~Y~^~some text8~^~~^8.38 |
This file contains hidden or 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
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 = """\^""" |
This file contains hidden or 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 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._ |
This file contains hidden or 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
<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> |
This file contains hidden or 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
$( "#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 |
This file contains hidden or 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
<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> |
This file contains hidden or 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 net.liftweb.http._ | |
import S._ | |
import js._ | |
import JsCmds._ | |
import JE._ | |
import net.liftweb.util._ | |
import Helpers._ | |
import scala.xml.Text | |
class AjaxCall { |