This file contains hidden or 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
| DATE AND TIME FORMAT CODES | |
| %a Abbreviated weekday name | |
| %A Full weekday name | |
| %b Abbreviated month name | |
| %B Full month name | |
| %c Date and time representation for your locale | |
| %d Day of month as a decimal number (01-31) | |
| %H Hour in 24-hour format (00-23) | |
| %I Hour in 12-hour format (01-12) |
This file contains hidden or 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
| class Monad m where | |
| (>>=) :: m a -> (a -> m b) -> m b | |
| return :: a -> m a | |
| class Comonad w where | |
| (=>>) :: w a -> (w a -> b) -> w b | |
| extract :: w a -> a |
This file contains hidden or 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
| class User extends MongoRecord[User] with MongoId[User] { | |
| def meta = User | |
| protected def valUnique(msg: String)(value: String): | |
| List[FieldError] = { | |
| Console.println("Not the overloaded.") | |
| Nil | |
| } | |
| object userName extends StringField(this, "") { |
This file contains hidden or 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.util.Random | |
| class RandomTraversableOnce[A](seq:TraversableOnce[A]){ | |
| def choice = seq.toList (new Random nextInt seq.size) | |
| } | |
| implicit def toRandomTraversableOnce[A](seq:TraversableOnce[A]) = new RandomTraversableOnce(seq) |
This file contains hidden or 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
| For what it's worth, my experience learning Scala's type system was: | |
| - plain old (nominal) types: easy, same as Java | |
| - type parameterization: also easy, same as Java, but with square brackets instead of angle brackets. I felt square brackets looked a lot nicer, and probably was therefore easier to read, too. | |
| - function types: functions in Scala have nominal types like anything else, with a type parameter for the result type and one each for the parameter types. But there's also a shorthand syntax. Instead of Function1[String, Int], for example, you can say String => Int. The latter is actually easier to read, but when combined with an assignment such as "val a: String => Int = something I find it can sometimes be non-obvious at first glance how to parse it. | |
| - traits: traits were quite easy for me to understand and use. They are exactly like classes except they can't (currently) take constructor parameters and the meaning of super is different inside them. Mixing in multiple traits is straightforward, as i |
This file contains hidden or 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
| A few more tweaks & I dropped off a wee logo option here: http://dl.dropbox.com/u/6744016/logo_sm.png | |
| body { | |
| font-family: "Amaranth", arial, serif; | |
| text-shadow: 0px 1px -1px white; | |
| } | |
| .button { | |
| clear: both; | |
| background: #39C629; |
This file contains hidden or 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
| #include <string.h> | |
| #include <stdio.h> | |
| #include "handler.h" | |
| void handle_request(int sockfd, const char *request) | |
| { | |
| char *res = "HTTP 200 OK\r\n\r\n"; | |
| char file_buf[1024]; | |
| char url[1024]; |
This file contains hidden or 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 sbt._ | |
| class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) { | |
| val liftVersion = "2.2" | |
| // uncomment the following if you want to use the snapshot repo | |
| // val scalatoolsSnapshot = ScalaToolsSnapshots | |
| // Adding Metabroadcast's Maven repository | |
| val mavenMetabroadcast = "Metabroadcast Maven Repository" at "http://mvn.metabroadcast.com/all" |
This file contains hidden or 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
| sudo apt-get install --reinstall libgl1-mesa-dev mesa-common-dev libgl1-mesa-dri-dev libglu1-mesa-dev freeglut-dev |
This file contains hidden or 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 django.conf import settings | |
| from django.utils.translation import string_concat, ugettext_lazy | |
| from django.utils.html import strip_tags | |
| from haystack import indexes, site | |
| from cms.models.managers import PageManager | |
| from cms.models.pagemodel import Page | |
| from cms.models.pluginmodel import CMSPlugin |