This file contains 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 java.io.File | |
import play.api._ | |
import play.api.Application | |
import play.api.db.slick.Database | |
import scala.slick.model.codegen.SourceCodeGenerator | |
import scala.slick.jdbc.meta.createModel | |
/** | |
*/ | |
object PlaySlickCodeGenerator { |
This file contains 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
from fabric.api import local, env, run, roles, execute, put | |
from fabric.utils import abort | |
env.user = "playuser" | |
env.roledefs = { | |
'web': ['web.example.com'], | |
'batch': ['batch.example.com'] | |
} | |
env.num_of_releases = 3 |
This file contains 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
(put 'upcase-region 'disabled nil) | |
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp")) | |
(add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-install")) | |
;; key bindings | |
(global-set-key "\C-c\C-c" 'comment-or-uncomment-region) | |
(global-set-key (kbd "C-x <up>") 'windmove-up) | |
(global-set-key (kbd "C-x <down>") 'windmove-down) |
This file contains 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
<html> | |
<header> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script type="text/javascript" src="/javascripts/jquery-1.6.4.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
var url = "http://example.com/"; | |
var query = 'select * from html where url="' + url + '" and xpath="*"'; |
This file contains 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
/** | |
* Based on the following discussion: | |
* http://stackoverflow.com/questions/2345784/jquery-get-height-of-hidden-element-in-jquery | |
* @param jQuery $elem jQuery object | |
*/ | |
function getHeightOfHiddenElem($elem) { | |
$clone = $elem.clone(); | |
$clone.css({'position':'absolute','visibility':'hidden','display':'block'}); | |
$('body').append($clone) | |
var height = $clone.height(); |
This file contains 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
// 1. Class for MySQL point type | |
class MySQLPoint(val lat: Double, val lng: Double) { | |
import MySQLPoint._ | |
override def toString = { | |
lat.toString() + "," + lng.toString() | |
} | |
/** | |
* Gets a binary representation |
This file contains 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
// jQuery UI doesn't work with Japanese, Chinese and probably other | |
// languages' IMEs. | |
// | |
// This code snippet is a modified code of jQuery UI Autocomplete 1.8.16 | |
// that works with Japanese IME. It's based on the code in the ticket below. | |
// http://bugs.jqueryui.com/ticket/5933 | |
// | |
// I briefly tested it, and it seems ok. | |
// Any comments/feedback would be appreciated. | |
// |
This file contains 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
// http://stackoverflow.com/questions/4604237/how-to-write-to-a-file-in-scala | |
FileUtils.printToFile(tempFile)(writer => { | |
val it = Source.fromFile(conf).getLines() | |
for (line <- it) { | |
startPattern.findFirstIn(line) match { | |
case Some(_) => | |
while (it.hasNext && it.next.length != 0) {} | |
case _ => | |
writer.println(line) | |
} |
This file contains 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
(1 to 100)foreach{x=>println(if(x%15>0)if(x%5>0)if(x%3>0)x else"Fizz"else"Buzz"else"FizzBuzz")} |
This file contains 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
// This file is distributed under the same license as that of Lift. | |
package com.example | |
package lib | |
import net.liftweb.mapper._ | |
import net.liftweb.common._ | |
import net.liftweb.http.S | |
trait MegaCRUDify[KeyType, CrudType <: KeyedMapper[KeyType, CrudType]] |