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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>{+title}7th-Degree{/title}</title> | |
<script type="text/javascript" src='/javascripts/utils.js'></script> | |
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css"> | |
{+http_header/} | |
</head> | |
<body> | |
<div id="wrapper"> |
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
// Module dependencies. | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http') | |
, fs = require('fs') | |
, path = require('path') | |
, cons = require('consolidate') | |
var app = express(); |
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
{?username} | |
{username} | |
{:else} | |
Please Log-In! |
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> | |
<head> | |
<script src="dust-full-0.3.0.min.js"></script> | |
<script type="text/javascript"> | |
//example showing client-side compiling and rendering | |
var compiled = dust.compile("Hello {name}!", "index"); | |
dust.loadSource(compiled); | |
dust.render("index", {name: "David"}, function(err, out) { | |
if(err!= null) |
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> | |
<head> | |
<script src="dust-full-0.3.0.min.js"></script> | |
<script type="text/javascript"> | |
//example showing client-side compiling and rendering | |
var compiled = dust.compile("Hello {name}!", "index"); | |
dust.loadSource(compiled); | |
dust.render("index", {name: "David"}, function(err, out) { | |
if(err != null) |
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
<form id="form" name="form" method="post" action="/signin"> | |
<h1>Sign-in form</h1> | |
<div><label>Username | |
</label> | |
<input type="text" name="user[username]" class="required" id="username"/></div> | |
<div> | |
<input type="password" name="user[password]" class="required" id="password"/></div> |
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
detach { //this creates a new actor | |
completeWith { //we use a completeWith directive which respones with whatever we output at the end of the code block | |
var person = new Person(); | |
person.address = getAddress(address['latitude'], address['longitude']).then((result) => person.address = result) | |
person.save | |
"saved!" | |
} | |
} |
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
@tailrec | |
def extractor[T](resultSet: ResultSet, | |
result: scala.collection.mutable.Builder[T, Vector[T]] = Vector.newBuilder[T])( process: ResultSet => T ): Vector[T] = { | |
if (!resultSet.next) result.result() | |
else { | |
val value = process(resultSet) | |
extractor(resultSet, result += value)(process) | |
} | |
} |
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 DbWrapper._ | |
import scala.util.{Failure, Success, Try} | |
class Auctioneer { | |
/** | |
* | |
* @param item | |
* @return Boolean Whether or not the auction was successfully started | |
*/ | |
def startAuction(item: Item): Boolean = { |
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 scala.annotation.tailrec | |
import scala.collection.mutable | |
object Euler02 extends App { | |
@tailrec | |
def fib(num: Int, prev: Int, result: mutable.Builder[Int, Vector[Int]] = Vector.newBuilder[Int]): Vector[Int] = { | |
num match { | |
case 0 => result.result() | |
case x if x > 4000000 => result.result() |
OlderNewer