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.actors._ | |
import scala.actors.Actor._ | |
val helloActor = actor { | |
receive { | |
case nextActor : Actor => { | |
println("Hello Actor linked to " + nextActor) | |
while(true) { | |
receive { | |
case message : String => { |
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
" Based on example from here: http://stackoverflow.com/questions/3626203/text-editor-for-scala | |
set nocompatible "Not vi compativle (Vim is king) | |
"""""""""""""""""""""""""""""""""" | |
" Syntax and indent | |
"""""""""""""""""""""""""""""""""" | |
syntax on " Turn on syntax highligthing | |
set showmatch "Show matching bracets when text indicator is over them | |
colorscheme delek |
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
abstract class Expr | |
case class Var(name: String) extends Expr | |
case class Number(num: Double) extends Expr | |
case class UnOp(operator: String, arg: Expr) extends Expr | |
case class BinOp(operator: String, left: Expr, right: Expr) extends Expr | |
class Plus(left: Expr, right: Expr) extends BinOp("+", left, right) | |
def simplifyTop(expr: Expr): Expr = expr match { | |
case UnOp("-", UnOp("-", e)) => e | |
case BinOp("+", e, Number(0)) => e | |
case BinOp("*", e, Number(1)) => e |
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 Data.Char | |
import System.Random | |
main = do | |
randomGen <- newStdGen | |
let getR = getRandom randomGen | |
contents <- getContents | |
outputStory . (generateStory 10 getR) $ contents | |
putStrLn "" |
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 Text.XML.HaXml.ParseLazy as PL | |
import Text.XML.HaXml | |
import Text.XML.HaXml.Posn | |
import System.IO | |
main = do | |
inh <- openFile "badges.xml" ReadMode | |
hSetEncoding inh utf8_bom | |
inpStr <- hGetContents inh | |
let (Document _ _ root _) = PL.xmlParse "badges.xml" inpStr |
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
var staticDomain = ConfigurationManager.AppSettings["StaticDomain"]; | |
settings.UrlModifier = new StaticDomainUrlModifier(settings.UrlModifier, staticDomain); |
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
public class ConstantsGenerator : IAssetTransformer | |
{ | |
private const char ConstantStartToken = '#'; | |
private const char OpeningBraceToken = '{'; | |
private const char ClosingBraceToken = '}'; | |
private readonly Dictionary<string, string> values; | |
public ConstantsGenerator(Dictionary<string, string> values) | |
{ | |
this.values = values; |
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
class SampleViewModel | |
constructor: (values) -> | |
this.title = ko.observable() | |
this.description = ko.observable() | |
this.isPrivate = ko.observable() | |
this.status = ko.observable "Active" | |
this.showApproveReject = ko.computed => @isActive() | |
this.statusUrl = ko.observable() | |
this.privacyUrl = ko.observable() | |
_.extend(this, Backbone.Events) |
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
(define (sum-of-squares a b) | |
(+ (square a) (square b))) | |
(define (sum-of-squares-of-max-2 a b c) | |
(if (> a b) | |
(if (> b c) | |
(sum-of-squares a b) | |
(sum-of-squares a c)) | |
(if (> a c) | |
(sum-of-squares a b) |
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
CREATE DATABASE [OrderedInsert] | |
GO | |
ALTER DATABASE [OrderedInsert] SET ALLOW_SNAPSHOT_ISOLATION ON | |
GO | |
USE [OrderedInsert] | |
GO | |
CREATE TABLE [dbo].[Test]( |
OlderNewer