Skip to content

Instantly share code, notes, and snippets.

@mbseid
mbseid / Adding to server.xml
Created October 18, 2011 20:01
ColdGold Hole #2
<cffunction name="getFile">
<cfargument name="path">
<cffile action="READ" file="#path#" variable="serverXML">
<cfreturn xmlParse(serverXML)>
</cffunction>
<cffunction name="writeFile">
<cfargument name="path">
<cfargument name="xml">
<cffile action="write" file="#path#" output="#ToString(xml)#">
</cffunction>
@mbseid
mbseid / gist:2924219
Created June 13, 2012 13:55
Deadbold Resolver
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "Blog"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
@mbseid
mbseid / Build.scala
Created July 23, 2012 15:03 — forked from andypetrella/Build.scala
Gatling SBT Test
import sbt._
import Keys._
import GatlingPlugin._
object MinimalBuild extends Build {
val SNAPSHOT = "-SNAPSHOT"
val appName = "gatling-sbt-sample"
val buildVersion = "0.0.1-SNAPSHOT"
@mbseid
mbseid / AbstractDAO.java
Created August 16, 2012 17:25
Using Ebean with Play! Framework 2
package daos;
import java.util.*;
import javax.persistence.*;
import play.*;
import play.db.ebean.*;
import play.db.ebean.Model.*;
import play.data.format.*;
import play.data.validation.*;
@mbseid
mbseid / ApplicationBuild.scala
Created August 29, 2012 21:46
ApplicationBuild.scala
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "website"
val appVersion = "1.2"
val common = PlayProject(
@mbseid
mbseid / build.sh
Last active December 15, 2015 04:59
Require.js intro
node r.js -o build.js
node r.js -o build.js optimize=none
@mbseid
mbseid / Scratch.scala
Created June 10, 2013 14:44
Using Salat References
case class Author(id:ObjectId, name:String)
case class Book(id:ObjectId, name:String, authorId:ObjectId){
//For eager relationship
val author = Author.findOneById(authorId)
//For lazy relationship
lazy val author = Author.findOneById(authorId)
}
@mbseid
mbseid / js-selectors.html
Last active January 2, 2016 15:39
HTML/CSS guidlines
<!-- Bad Code -->
<div class="validation">
...
<button class="btn btn-danger">Delete</button>
</div>
<script>
$(".validation .btn-danger").on('click', function(){ ... });
</script>
@mbseid
mbseid / Global.scala
Last active July 6, 2018 10:33
Play Framework 2 HTTPS Redirect
override def onRouteRequest(req: RequestHeader): Option[Handler] = {
(req.method, req.headers.get("X-Forwarded-Proto")) match {
case ("GET", Some(protocol)) if protocol != "https" => Some(Action{ MovedPermanently("https://"+req.host+req.uri)})
case (_, _) => super.onRouteRequest(req)
}
}
@(title:Option[String], contentString:Option[String], placement:String = "left", style:String = "default")(content:Html = Html.empty)
<span class="help @style" rel="popover" data-popover data-trigger="hover" data-placement="@placement" data-original-title="@title" data-content="@contentString.getOrElse(content)">?</span>