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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Card Flip Editor</title> | |
<style> | |
body, html { | |
height: 100%; | |
margin: 0; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>CSS Tabs Example</title> | |
<script> | |
/* | |
This script enables direct-linking to a tab. |
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
package util | |
object Slug { | |
def apply(input:String) = slugify(input) | |
def slugify(input: String): String = { | |
import java.text.Normalizer | |
Normalizer.normalize(input, Normalizer.Form.NFD) | |
.replaceAll("[^\\w\\s-]", "") // Remove all non-word, non-space or non-dash characters | |
.replace('-', ' ') // Replace dashes with spaces |
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
if ! [ -d /Library/Java/JavaVirtualMachines/1.7.0u6.jdk ]; then | |
echo "Downloading OpenJDK 7" | |
curl -o /tmp/OpenJDK-7.dmg http://openjdk-osx-build.googlecode.com/files/OpenJDK-OSX-1.7-universal-u-jdk-jdk7u6-b10-20120522.dmg | |
echo "Attaching DMG image" | |
hdiutil attach /tmp/OpenJDK-7.dmg | |
echo "Copying JDK into available Java Virtual Machines" | |
sudo cp -R /Volumes/OpenJDK\ 7\ \(Mac\ OS:X\ Port\)/1.7.0u.jdk /Library/Java/JavaVirtualMachines/1.7.0u6.jdk | |
echo "Detach DMG image" | |
hdiutil detach /Volumes/OpenJDK\ 7\ \(Mac\ OS:X\ Port\) |
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
// Zip together a couple Futures, including one that returns an Option | |
// and pass them to a function to give me a new object: | |
api.channels.tree zip api.pages.getByRoute(route) map { | |
case (tree, Some(page)) => Some(new PagePresenter(context, tree, page)) | |
case _ => None | |
} | |
// Now with an Applicative Functor! | |
(api.channels.tree |@| api.pages.getByRoute(route)) { |
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
pathEndOrSingleSlash { | |
(post & parameter("rev")) { rev => | |
// This is very important, so we can provide a more specific | |
// implicit to overcome the Json4sSupport default unmarshaller | |
// that will require an `application/json` ContentType! | |
import Unmarshaller._ | |
entity(as[Multipart.General]) { body => | |
import scala.concurrent.duration._ |
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
"Delete" taggedAs(tag.RolesTag) in { | |
val request = (FakeRequest(_:String, "/admin/roles/role-bob")) andThen | |
withAdminCredentials andThen | |
(route(_:FakeRequest[AnyContentAsEmpty.type])) | |
for { result <- request(DELETE) } { | |
status(result) must equal(SEE_OTHER) | |
flash(result).data must contain key("deleted") | |
} |
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
// fold | |
client ! Projects(rows.headOption.fold(Nil)(_ \ "value" extract)) | |
// map.getOrElse | |
client ! Projects(rows.headOption | |
.map(_ \ "value" extract) | |
.getOrElse(Nil)) | |
// Option.toList | |
client ! Projects(rows.headOption.toList.map(_ \ "value" extract)) |
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
// Don't include private.conf in main package. | |
mappings in (Compile, packageBin) ~= { | |
_ filter { | |
case (_, "private.conf") => false | |
case _ => true | |
} | |
} | |
// Don't include private.conf in main sources package. | |
mappings in (Compile, packageSrc) ~= { |
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 org.json4s._ | |
case object IdSerializer extends CustomSerializer[Id](formats => ( { | |
case JObject(JField("prefix", JString(prefix)) :: JField("id", JString(id)) :: JField("rev", JString(rev)) :: Nil) => IdWithRev(prefix, id, rev) | |
case JObject(JField("prefix", JString(prefix)) :: JField("id", JString(id)) :: Nil) => NewId(prefix, id) | |
}, { | |
case NewId(prefix, id) => JObject(JField("prefix", JString(prefix)) :: JField("id", JString(id)) :: Nil) | |
case IdWithRev(prefix, id, rev) => JObject(JField("prefix", JString(prefix)) :: JField("id", JString(id)) :: JField("rev", JString(rev)) :: Nil) | |
} | |
)) |
NewerOlder