Skip to content

Instantly share code, notes, and snippets.

@mbseid
mbseid / landingpage.html
Last active August 29, 2015 14:19
LandingPage
<html>
</head>
<title>Thank you for sharing!</title>
<script>
!function(n,a,y,t,e,v,s){var globalNameSpace="GlobalNaytevNamespace";
n[e]||(n[globalNameSpace]=n[globalNameSpace]||[],n[globalNameSpace].push(e),n[e]=function(){(n[e].q=n[e].q||[]).push(arguments)
},n[e].q=n[e].q||[],v=a.createElement(y),s=a.getElementsByTagName(y)[0],v.async=1,v.src=t,s.parentNode.insertBefore(v,s))
}(window,document,"script","http://naytev-embed.global.ssl.fastly.net/prod/naytev.min.js","naytev");
naytev("create", "551edbc6e4b0asdf23445b0d9fca");
naytev("bind", "naytev.ready", function(){
@mbseid
mbseid / Rebind.js
Created April 13, 2015 16:30
Rebind for HTML5 History
naytev('activate')
!function(n,a,y,t,e,v,s){var globalNameSpace="GlobalNaytevNamespace";
n[e]||(n[globalNameSpace]=n[globalNameSpace]||[],n[globalNameSpace].push(e),n[e]=function(){(n[e].q=n[e].q||[]).push(arguments)
},n[e].q=n[e].q||[],v=a.createElement(y),s=a.getElementsByTagName(y)[0],v.async=1,v.src=t,s.parentNode.insertBefore(v,s))
}(window,document,"script","//naytev-embed.global.ssl.fastly.net/prod/naytev.min.js","naytev");
naytev("create", "551edbc6e4b0asdf23445b0d9fca");
@mbseid
mbseid / gist:9fa3fdf75c4940eef5ca
Created July 19, 2014 22:44
Javascript String Primative
String.prototype.foobar = function(){return this;}
> function (){return this;}
typeof "foo"
> "string"
typeof "foo".foobar()
> "object"
@(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>
@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)
}
}
@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 / 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 / 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 / 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(