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
| case class Fail(text: Option[String]) | |
| object Main extends App { | |
| import org.json4s._ | |
| import org.json4s.native.Serialization | |
| import org.json4s.native.Serialization.{read, write} | |
| implicit val formats = org.json4s.DefaultFormats | |
| read[Fail]("""{"notext":"foo"}""").text match { | |
| case Some(txt) => // ClassCastException here when using json4s v3.1.0 |
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
| object People { | |
| implicit val columnFamily: ColumnFamily = getColumnFamily | |
| def getPersonByName(name: String)(implicit cf: ColumnFamily) = ... | |
| } | |
| class ProdUsage { | |
| // uses ColumnFamily from object People | |
| def foo = People.getPersonByName("Jordan") | |
| } |
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
| #!/bin/sh | |
| msg=$(git log -n 1 --format="%B") | |
| git reset HEAD^ | |
| git add -A | |
| git commit -m "$msg" |
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
| def bar(value: Int) = foo(Some(value / 3)) | |
| def foo(value: Option[Int]): Option[Int] = value match { | |
| case Some(v) if (v % 2 == 0) => bar(v) | |
| case Some(v) => Some(v) | |
| case None => None | |
| } |
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
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"> | |
| <script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script> | |
| <style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style> | |
| <body> | |
| <div style="max-width:900px; -webkit-transform:rotate(0deg)"> | |
| <scene id="scene1"> | |
| <label t="translate(0,346)"> |
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
| # Add this line to your software sources | |
| deb http://debian.meebey.net/experimental/mono / | |
| sudo apt-get update | |
| # of course, apt-get remove mono-complete first... | |
| sudo apt-get install mono-complete | |
| # I installed monodevelop from apt just to get all the prereqs | |
| sudo apt-get install monodevelop |
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 Anon1 | |
| { | |
| private int second; | |
| // constructor | |
| public Anon1(int second) | |
| { | |
| this.second = second; | |
| } |
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
| public class Word { | |
| public int Id { get; set; } | |
| public string Name { get; set; } | |
| public IList<Definition> Definitions { get; private set; } | |
| } | |
| public class Definition { | |
| public int Id { get; set; } | |
| public int WordId { get; set; } | |
| public string Text { get; set; } |
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
| public abstract class DomainObject : IDomainObject | |
| { | |
| public virtual object Id { get; set; } | |
| #region Overloads of Equals & GetHashCode | |
| // ... | |
| #endregion | |
| } |
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
| public enum LightSwith | |
| { | |
| On, | |
| Dimmed(int intensity), | |
| Off | |
| } | |
| // And to use | |
| var value = GetLightSwitchValue(); |