├── .config └── dotnet-tools.json ├── .gitattributes ├── .gitignore ├── .paket └── paket.bootstrapper.exe ├── README.md ├── build.cmd ├── build.fsx ├── build.sh ├── paket.dependencies ├── paket.lock └── slides ├── custom.css ├── images └── logo.png ├── index.md └── sample.fsx /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "paket": { 6 | "version": "9.0.2", 7 | "commands": [ 8 | "paket" 9 | ], 10 | "rollForward": false 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | # Autodetect text or binary. Do not leave merge conflict markers in the files. 5 | * text=auto merge=union 6 | 7 | # Use LF in the working directory by default. Override with core.autocrlf=true. 8 | *.fs eol=lf 9 | 10 | # Visual Studio can read LF sln files, but it always writes them as CRLF. 11 | *.sln eol=crlf 12 | 13 | ############################################################################### 14 | # Set default behavior for command prompt diff. 15 | # 16 | # This is need for earlier builds of msysgit that does not have it on by 17 | # default for csharp files. 18 | # Note: This is only used by command line 19 | ############################################################################### 20 | #*.cs diff=csharp 21 | 22 | ############################################################################### 23 | # Set the merge driver for project and solution files 24 | # 25 | # Merging from the command prompt will add diff markers to the files if there 26 | # are conflicts (Merging from VS is not affected by the settings below, in VS 27 | # the diff markers are never inserted). Diff markers may cause the following 28 | # file extensions to fail to load in VS. An alternative would be to treat 29 | # these files as binary and thus will always conflict and require user 30 | # intervention with every merge. To do so, just uncomment the entries below 31 | ############################################################################### 32 | #*.sln merge=binary 33 | #*.csproj merge=binary 34 | #*.vbproj merge=binary 35 | #*.vcxproj merge=binary 36 | #*.vcproj merge=binary 37 | #*.dbproj merge=binary 38 | #*.fsproj merge=binary 39 | #*.lsproj merge=binary 40 | #*.wixproj merge=binary 41 | #*.modelproj merge=binary 42 | #*.sqlproj merge=binary 43 | #*.wwaproj merge=binary 44 | 45 | ############################################################################### 46 | # behavior for image files 47 | # 48 | # image files are treated as binary by default. 49 | ############################################################################### 50 | #*.jpg binary 51 | #*.png binary 52 | #*.gif binary 53 | 54 | ############################################################################### 55 | # diff behavior for common document formats 56 | # 57 | # Convert binary document formats to text before diffing them. This feature 58 | # is only available from the command line. Turn it on by uncommenting the 59 | # entries below. 60 | ############################################################################### 61 | #*.doc diff=astextplain 62 | #*.DOC diff=astextplain 63 | #*.docx diff=astextplain 64 | #*.DOCX diff=astextplain 65 | #*.dot diff=astextplain 66 | #*.DOT diff=astextplain 67 | #*.pdf diff=astextplain 68 | #*.PDF diff=astextplain 69 | #*.rtf diff=astextplain 70 | #*.RTF diff=astextplain 71 | 72 | *.sh text eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Xamarin Studio / monodevelop user-specific 10 | *.userprefs 11 | 12 | # Build results 13 | 14 | [Dd]ebug/ 15 | [Rr]elease/ 16 | x64/ 17 | build/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | 21 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 22 | !packages/*/build/ 23 | 24 | # MSTest test Results 25 | [Tt]est[Rr]esult*/ 26 | [Bb]uild[Ll]og.* 27 | 28 | *_i.c 29 | *_p.c 30 | *.ilk 31 | *.meta 32 | *.obj 33 | *.pch 34 | *.pdb 35 | *.pgc 36 | *.pgd 37 | *.rsp 38 | *.sbr 39 | *.tlb 40 | *.tli 41 | *.tlh 42 | *.tmp 43 | *.tmp_proj 44 | *.log 45 | *.vspscc 46 | *.vssscc 47 | .builds 48 | *.pidb 49 | *.log 50 | *.scc 51 | 52 | # Visual C++ cache files 53 | ipch/ 54 | *.aps 55 | *.ncb 56 | *.opensdf 57 | *.sdf 58 | *.cachefile 59 | 60 | # Visual Studio profiler 61 | *.psess 62 | *.vsp 63 | *.vspx 64 | 65 | # Guidance Automation Toolkit 66 | *.gpState 67 | 68 | # ReSharper is a .NET coding add-in 69 | _ReSharper*/ 70 | *.[Rr]e[Ss]harper 71 | 72 | # TeamCity is a build add-in 73 | _TeamCity* 74 | 75 | # DotCover is a Code Coverage Tool 76 | *.dotCover 77 | 78 | # NCrunch 79 | *.ncrunch* 80 | .*crunch*.local.xml 81 | 82 | # Installshield output folder 83 | [Ee]xpress/ 84 | 85 | # DocProject is a documentation generator add-in 86 | DocProject/buildhelp/ 87 | DocProject/Help/*.HxT 88 | DocProject/Help/*.HxC 89 | DocProject/Help/*.hhc 90 | DocProject/Help/*.hhk 91 | DocProject/Help/*.hhp 92 | DocProject/Help/Html2 93 | DocProject/Help/html 94 | 95 | # Click-Once directory 96 | publish/ 97 | 98 | # Publish Web Output 99 | *.Publish.xml 100 | 101 | # Enable nuget.exe in the .nuget folder (though normally executables are not tracked) 102 | !.nuget/NuGet.exe 103 | 104 | # Windows Azure Build Output 105 | csx 106 | *.build.csdef 107 | 108 | # Windows Store app package directory 109 | AppPackages/ 110 | 111 | # Others 112 | sql/ 113 | *.Cache 114 | ClientBin/ 115 | [Ss]tyle[Cc]op.* 116 | ~$* 117 | *~ 118 | *.dbmdl 119 | *.[Pp]ublish.xml 120 | *.pfx 121 | *.publishsettings 122 | 123 | # RIA/Silverlight projects 124 | Generated_Code/ 125 | 126 | # Backup & report files from converting an old project file to a newer 127 | # Visual Studio version. Backup files are not needed, because we have git ;-) 128 | _UpgradeReport_Files/ 129 | Backup*/ 130 | UpgradeLog*.XML 131 | UpgradeLog*.htm 132 | 133 | # SQL Server files 134 | App_Data/*.mdf 135 | App_Data/*.ldf 136 | 137 | 138 | #LightSwitch generated files 139 | GeneratedArtifacts/ 140 | _Pvt_Extensions/ 141 | ModelManifest.xml 142 | 143 | # ========================= 144 | # Windows detritus 145 | # ========================= 146 | 147 | # Windows image file caches 148 | Thumbs.db 149 | ehthumbs.db 150 | 151 | # Folder config file 152 | Desktop.ini 153 | 154 | # Recycle Bin used on file shares 155 | $RECYCLE.BIN/ 156 | 157 | # Mac desktop service store files 158 | .DS_Store 159 | 160 | # =================================================== 161 | # Exclude F# project specific directories and files 162 | # =================================================== 163 | 164 | # NuGet Packages Directory 165 | packages/ 166 | 167 | # Generated documentation folder 168 | docs/output/ 169 | 170 | # Temp folder used for publishing docs 171 | temp/ 172 | 173 | # Test results produced by build 174 | TestResults.xml 175 | 176 | # Nuget outputs 177 | nuget/*.nupkg 178 | .paket/paket.exe 179 | output 180 | paket-files 181 | release.cmd 182 | *.bak 183 | *.orig 184 | docs 185 | .fake/ 186 | FSharp.Formatting.svclog 187 | _NCrunch* 188 | -------------------------------------------------------------------------------- /.paket/paket.bootstrapper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsprojects/FsReveal/4e3daadfcd1a04f0919bd8e3e096a5785c641187/.paket/paket.bootstrapper.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Issue Stats](http://issuestats.com/github/fsprojects/FsReveal/badge/issue)](http://issuestats.com/github/fsprojects/FsReveal) 2 | [![Issue Stats](http://issuestats.com/github/fsprojects/FsReveal/badge/pr)](http://issuestats.com/github/fsprojects/FsReveal) 3 | 4 | # FsReveal [![NuGet Status](http://img.shields.io/nuget/v/FsReveal.svg?style=flat)](https://www.nuget.org/packages/FsReveal/) 5 | 6 | FsReveal allows you to write beautiful slides in [Markdown](http://daringfireball.net/projects/markdown/syntax) 7 | and brings F# to the [reveal.js][revealjs] web presentation framework. 8 | 9 | ## Features 10 | 11 | - Write your slides in [Markdown](http://daringfireball.net/projects/markdown/syntax) or .fsx files 12 | - Automatically updates the browser in edit mode on every save 13 | - Syntax highlighting for most programming languages including C#, F# and LaTeX 14 | - Speaker notes; Shows the current slide, next slide, elapsed time and current time 15 | - Built in themes 16 | - Horizontal and vertical slides 17 | - Built in slide transitions using CSS 3D transforms 18 | - Slide overview 19 | - Works on mobile browsers. Swipe your way through the presentation. 20 | 21 | [Examples](http://fsprojects.github.io/FsReveal/index.html#Examples) and a [Getting started guide](http://fsprojects.github.io/FsReveal/getting-started.html) can be found in the docs. 22 | 23 | [revealjs]: https://github.com/hakimel/reveal.js/ "reveal.js | HTML presentations made easy" 24 | 25 | ### Maintainer(s) 26 | 27 | - [@kimsk](https://github.com/kimsk) 28 | - [@forki](https://github.com/forki) 29 | - [@troykershaw](https://github.com/troykershaw) 30 | 31 | The default maintainer account for projects under "fsprojects" is [@fsprojectsgit](https://github.com/fsprojectsgit) - F# Community Project Incubation Space (repo management) 32 | -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | cls 3 | 4 | dotnet tool restore 5 | if errorlevel 1 ( 6 | exit /b %errorlevel% 7 | ) 8 | 9 | dotnet paket restore 10 | if errorlevel 1 ( 11 | exit /b %errorlevel% 12 | ) 13 | 14 | packages\FAKE\tools\FAKE.exe build.fsx %* 15 | -------------------------------------------------------------------------------- /build.fsx: -------------------------------------------------------------------------------- 1 | #I @"packages/FsReveal/fsreveal/" 2 | #I @"packages/FAKE/tools/" 3 | #I @"packages/Suave/lib/net40" 4 | 5 | #r "FakeLib.dll" 6 | #r "Suave.dll" 7 | 8 | #load "fsreveal.fsx" 9 | 10 | // Git configuration (used for publishing documentation in gh-pages branch) 11 | // The profile where the project is posted 12 | let gitOwner = "myGitUser" 13 | let gitHome = "https://github.com/" + gitOwner 14 | // The name of the project on GitHub 15 | let gitProjectName = "MyProject" 16 | // The name of the GitHub repo subdirectory to publish slides to 17 | let gitSubDir = "" 18 | 19 | open FsReveal 20 | open Fake 21 | open Fake.Git 22 | open System.IO 23 | open System.Diagnostics 24 | open Suave 25 | open Suave.Web 26 | open Suave.Http 27 | open Suave.Operators 28 | open Suave.Sockets 29 | open Suave.Sockets.Control 30 | open Suave.Sockets.AsyncSocket 31 | open Suave.WebSocket 32 | open Suave.Utils 33 | open Suave.Files 34 | 35 | let outDir = __SOURCE_DIRECTORY__ "output" 36 | let slidesDir = __SOURCE_DIRECTORY__ "slides" 37 | 38 | Target "Clean" (fun _ -> 39 | CleanDirs [outDir] 40 | ) 41 | 42 | let fsiEvaluator = 43 | let evaluator = FSharp.Literate.FsiEvaluator() 44 | evaluator.EvaluationFailed.Add(fun err -> 45 | traceImportant <| sprintf "Evaluating F# snippet failed:\n%s\nThe snippet evaluated:\n%s" err.StdErr err.Text ) 46 | evaluator 47 | 48 | let copyStylesheet() = 49 | try 50 | CopyFile (outDir "css" "custom.css") (slidesDir "custom.css") 51 | with 52 | | exn -> traceImportant <| sprintf "Could not copy stylesheet: %s" exn.Message 53 | 54 | let copyPics() = 55 | try 56 | CopyDir (outDir "images") (slidesDir "images") (fun f -> true) 57 | with 58 | | exn -> traceImportant <| sprintf "Could not copy picture: %s" exn.Message 59 | 60 | let generateFor (file:FileInfo) = 61 | try 62 | copyPics() 63 | let rec tryGenerate trials = 64 | try 65 | FsReveal.GenerateFromFile(file.FullName, outDir, fsiEvaluator = fsiEvaluator) 66 | with 67 | | exn when trials > 0 -> tryGenerate (trials - 1) 68 | | exn -> 69 | traceImportant <| sprintf "Could not generate slides for: %s" file.FullName 70 | traceImportant exn.Message 71 | 72 | tryGenerate 3 73 | 74 | copyStylesheet() 75 | with 76 | | :? FileNotFoundException as exn -> 77 | traceImportant <| sprintf "Could not copy file: %s" exn.FileName 78 | 79 | let refreshEvent = new Event<_>() 80 | 81 | let handleWatcherEvents (events:FileChange seq) = 82 | for e in events do 83 | let fi = fileInfo e.FullPath 84 | traceImportant <| sprintf "%s was changed." fi.Name 85 | match fi.Attributes.HasFlag FileAttributes.Hidden || fi.Attributes.HasFlag FileAttributes.Directory with 86 | | true -> () 87 | | _ -> generateFor fi 88 | refreshEvent.Trigger() 89 | 90 | let socketHandler (webSocket : WebSocket) = 91 | fun cx -> socket { 92 | while true do 93 | let! refreshed = 94 | Control.Async.AwaitEvent(refreshEvent.Publish) 95 | |> Suave.Sockets.SocketOp.ofAsync 96 | do! webSocket.send Text (ASCII.bytes "refreshed") true 97 | } 98 | 99 | let startWebServer () = 100 | let rec findPort port = 101 | let portIsTaken = 102 | if isMono then false else 103 | System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners() 104 | |> Seq.exists (fun x -> x.Port = port) 105 | 106 | if portIsTaken then findPort (port + 1) else port 107 | 108 | let port = findPort 8083 109 | 110 | let serverConfig = 111 | { defaultConfig with 112 | homeFolder = Some (FullName outDir) 113 | bindings = [ HttpBinding.mkSimple HTTP "127.0.0.1" port ] 114 | } 115 | let app = 116 | choose [ 117 | Filters.path "/websocket" >=> handShake socketHandler 118 | Writers.setHeader "Cache-Control" "no-cache, no-store, must-revalidate" 119 | >=> Writers.setHeader "Pragma" "no-cache" 120 | >=> Writers.setHeader "Expires" "0" 121 | >=> browseHome ] 122 | startWebServerAsync serverConfig app |> snd |> Async.Start 123 | Process.Start (sprintf "http://localhost:%d/index.html" port) |> ignore 124 | 125 | Target "GenerateSlides" (fun _ -> 126 | !! (slidesDir + "/**/*.md") 127 | ++ (slidesDir + "/**/*.fsx") 128 | |> Seq.map fileInfo 129 | |> Seq.iter generateFor 130 | ) 131 | 132 | Target "KeepRunning" (fun _ -> 133 | use watcher = !! (slidesDir + "/**/*.*") |> WatchChanges handleWatcherEvents 134 | 135 | startWebServer () 136 | 137 | traceImportant "Waiting for slide edits. Press any key to stop." 138 | 139 | System.Console.ReadKey() |> ignore 140 | 141 | watcher.Dispose() 142 | ) 143 | 144 | Target "ReleaseSlides" (fun _ -> 145 | if gitOwner = "myGitUser" || gitProjectName = "MyProject" then 146 | failwith "You need to specify the gitOwner and gitProjectName in build.fsx" 147 | let tempDocsRoot = __SOURCE_DIRECTORY__ "temp/gh-pages" 148 | let tempDocsDir = tempDocsRoot gitSubDir 149 | CleanDir tempDocsRoot 150 | Repository.cloneSingleBranch "" (gitHome + "/" + gitProjectName + ".git") "gh-pages" tempDocsRoot 151 | 152 | fullclean tempDocsDir 153 | CopyRecursive outDir tempDocsDir true |> tracefn "%A" 154 | StageAll tempDocsRoot 155 | Git.Commit.Commit tempDocsRoot "Update generated slides" 156 | Branches.push tempDocsRoot 157 | ) 158 | 159 | "Clean" 160 | ==> "GenerateSlides" 161 | ==> "KeepRunning" 162 | 163 | "GenerateSlides" 164 | ==> "ReleaseSlides" 165 | 166 | RunTargetOrDefault "KeepRunning" 167 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet tool restore 4 | exit_code=$? 5 | if [ $exit_code -ne 0 ]; then 6 | exit $exit_code 7 | fi 8 | 9 | dotnet paket restore 10 | exit_code=$? 11 | if [ $exit_code -ne 0 ]; then 12 | exit $exit_code 13 | fi 14 | 15 | packages/FAKE/tools/FAKE.exe $@ build.fsx 16 | -------------------------------------------------------------------------------- /paket.dependencies: -------------------------------------------------------------------------------- 1 | source https://nuget.org/api/v2 2 | 3 | nuget FsReveal 4 | nuget FAKE 5 | nuget Suave -------------------------------------------------------------------------------- /paket.lock: -------------------------------------------------------------------------------- 1 | NUGET 2 | remote: https://www.nuget.org/api/v2 3 | FAKE (4.28) 4 | FSharp.Compiler.Service (2.0.0.6) 5 | FSharp.Core (4.0.0.1) 6 | FSharp.Formatting (2.14.4) 7 | FSharp.Compiler.Service (2.0.0.6) 8 | FSharpVSPowerTools.Core (>= 2.3 < 2.4) 9 | FSharpVSPowerTools.Core (2.3) 10 | FSharp.Compiler.Service (>= 2.0.0.3) 11 | FsReveal (1.3.1) 12 | FSharp.Formatting (>= 2.11) 13 | Suave (1.1.2) 14 | FSharp.Core (>= 3.1.2.5) 15 | -------------------------------------------------------------------------------- /slides/custom.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsprojects/FsReveal/4e3daadfcd1a04f0919bd8e3e096a5785c641187/slides/custom.css -------------------------------------------------------------------------------- /slides/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsprojects/FsReveal/4e3daadfcd1a04f0919bd8e3e096a5785c641187/slides/images/logo.png -------------------------------------------------------------------------------- /slides/index.md: -------------------------------------------------------------------------------- 1 | - title : FsReveal 2 | - description : Introduction to FsReveal 3 | - author : Karlkim Suwanmongkol 4 | - theme : night 5 | - transition : default 6 | 7 | *** 8 | 9 | ### What is FsReveal? 10 | 11 | - Generates [reveal.js](http://lab.hakim.se/reveal-js/#/) presentation from [markdown](http://daringfireball.net/projects/markdown/) 12 | - Utilizes [FSharp.Formatting](https://github.com/tpetricek/FSharp.Formatting) for markdown parsing 13 | - Get it from [http://fsprojects.github.io/FsReveal/](http://fsprojects.github.io/FsReveal/) 14 | 15 | ![FsReveal](images/logo.png) 16 | 17 | *** 18 | 19 | ### Reveal.js 20 | 21 | - A framework for easily creating beautiful presentations using HTML. 22 | 23 | 24 | > **Atwood's Law**: any application that can be written in JavaScript, will eventually be written in JavaScript. 25 | 26 | *** 27 | 28 | ### FSharp.Formatting 29 | 30 | - F# tools for generating documentation (Markdown processor and F# code formatter). 31 | - It parses markdown and F# script file and generates HTML or PDF. 32 | - Code syntax highlighting support. 33 | - It also evaluates your F# code and produce tooltips. 34 | 35 | *** 36 | 37 | ### Syntax Highlighting 38 | 39 | #### F# (with tooltips) 40 | 41 | let a = 5 42 | let factorial x = [1..x] |> List.reduce (*) 43 | let c = factorial a 44 | 45 | --- 46 | 47 | #### C# 48 | 49 | [lang=cs] 50 | using System; 51 | 52 | class Program 53 | { 54 | static void Main() 55 | { 56 | Console.WriteLine("Hello, world!"); 57 | } 58 | } 59 | 60 | --- 61 | 62 | #### JavaScript 63 | 64 | [lang=js] 65 | function copyWithEvaluation(iElem, elem) { 66 | return function (obj) { 67 | var newObj = {}; 68 | for (var p in obj) { 69 | var v = obj[p]; 70 | if (typeof v === "function") { 71 | v = v(iElem, elem); 72 | } 73 | newObj[p] = v; 74 | } 75 | if (!newObj.exactTiming) { 76 | newObj.delay += exports._libraryDelay; 77 | } 78 | return newObj; 79 | }; 80 | } 81 | 82 | 83 | --- 84 | 85 | #### Haskell 86 | 87 | [lang=haskell] 88 | recur_count k = 1 : 1 : 89 | zipWith recurAdd (recur_count k) (tail (recur_count k)) 90 | where recurAdd x y = k * x + y 91 | 92 | main = do 93 | argv <- getArgs 94 | inputFile <- openFile (head argv) ReadMode 95 | line <- hGetLine inputFile 96 | let [n,k] = map read (words line) 97 | printf "%d\n" ((recur_count k) !! (n-1)) 98 | 99 | *code from [NashFP/rosalind](https://github.com/NashFP/rosalind/blob/master/mark_wutka%2Bhaskell/FIB/fib_ziplist.hs)* 100 | 101 | --- 102 | 103 | ### SQL 104 | 105 | [lang=sql] 106 | select * 107 | from 108 | (select 1 as Id union all select 2 union all select 3) as X 109 | where Id in (@Ids1, @Ids2, @Ids3) 110 | 111 | *sql from [Dapper](https://code.google.com/p/dapper-dot-net/)* 112 | 113 | --- 114 | 115 | ### Paket 116 | 117 | [lang=paket] 118 | source https://nuget.org/api/v2 119 | 120 | nuget Castle.Windsor-log4net >= 3.2 121 | nuget NUnit 122 | 123 | github forki/FsUnit FsUnit.fs 124 | 125 | --- 126 | 127 | ### C/AL 128 | 129 | [lang=cal] 130 | PROCEDURE FizzBuzz(n : Integer) r_Text : Text[1024]; 131 | VAR 132 | l_Text : Text[1024]; 133 | BEGIN 134 | r_Text := ''; 135 | l_Text := FORMAT(n); 136 | 137 | IF (n MOD 3 = 0) OR (STRPOS(l_Text,'3') > 0) THEN 138 | r_Text := 'Fizz'; 139 | IF (n MOD 5 = 0) OR (STRPOS(l_Text,'5') > 0) THEN 140 | r_Text := r_Text + 'Buzz'; 141 | IF r_Text = '' THEN 142 | r_Text := l_Text; 143 | END; 144 | 145 | *** 146 | 147 | **Bayes' Rule in LaTeX** 148 | 149 | $ \Pr(A|B)=\frac{\Pr(B|A)\Pr(A)}{\Pr(B|A)\Pr(A)+\Pr(B|\neg A)\Pr(\neg A)} $ 150 | 151 | *** 152 | 153 | ### The Reality of a Developer's Life 154 | 155 | **When I show my boss that I've fixed a bug:** 156 | 157 | ![When I show my boss that I've fixed a bug](http://www.topito.com/wp-content/uploads/2013/01/code-07.gif) 158 | 159 | **When your regular expression returns what you expect:** 160 | 161 | ![When your regular expression returns what you expect](http://www.topito.com/wp-content/uploads/2013/01/code-03.gif) 162 | 163 | *from [The Reality of a Developer's Life - in GIFs, Of Course](http://server.dzone.com/articles/reality-developers-life-gifs)* 164 | 165 | -------------------------------------------------------------------------------- /slides/sample.fsx: -------------------------------------------------------------------------------- 1 | (** 2 | - title : FsReveal 3 | - description : Introduction to FsReveal 4 | - author : Karlkim Suwanmongkol 5 | - theme : Sky 6 | - transition : default 7 | 8 | *** 9 | 10 | ### What is FsReveal? 11 | 12 | - Generates [reveal.js](http://lab.hakim.se/reveal-js/#/) presentation from [markdown](http://daringfireball.net/projects/markdown/) 13 | - Utilizes [FSharp.Formatting](https://github.com/tpetricek/FSharp.Formatting) for markdown parsing 14 | 15 | *** 16 | 17 | ### Reveal.js 18 | 19 | - A framework for easily creating beautiful presentations using HTML. 20 | 21 | > **Atwood's Law**: any application that can be written in JavaScript, will eventually be written in JavaScript. 22 | 23 | *** 24 | 25 | ### FSharp.Formatting 26 | 27 | - F# tools for generating documentation (Markdown processor and F# code formatter). 28 | - It parses markdown and F# script file and generates HTML or PDF. 29 | - Code syntax highlighting support. 30 | - It also evaluates your F# code and produce tooltips. 31 | 32 | *** 33 | 34 | ### Syntax Highlighting 35 | 36 | #### F# (with tooltips) 37 | 38 | *) 39 | let a = 5 40 | let factorial x = [1..x] |> List.reduce (*) 41 | let c = factorial a 42 | (** 43 | `c` is evaluated for you 44 | *) 45 | (*** include-value: c ***) 46 | (** 47 | 48 | --- 49 | 50 | #### More F# 51 | 52 | *) 53 | [] type sqft 54 | [] type dollar 55 | let sizes = [|1700;2100;1900;1300|] 56 | let prices = [|53000;44000;59000;82000|] 57 | (** 58 | 59 | #### `prices.[0]/sizes.[0]` 60 | 61 | *) 62 | (*** include-value: prices.[0]/sizes.[0] ***) 63 | (** 64 | 65 | --- 66 | 67 | #### C# 68 | 69 | [lang=cs] 70 | using System; 71 | 72 | 73 | class Program 74 | { 75 | static void Main() 76 | { 77 | Console.WriteLine("Hello, world!"); 78 | } 79 | } 80 | 81 | 82 | --- 83 | 84 | #### JavaScript 85 | 86 | [lang=js] 87 | function copyWithEvaluation(iElem, elem) { 88 | return function (obj) { 89 | var newObj = {}; 90 | for (var p in obj) { 91 | var v = obj[p]; 92 | if (typeof v === "function") { 93 | v = v(iElem, elem); 94 | } 95 | newObj[p] = v; 96 | } 97 | if (!newObj.exactTiming) { 98 | newObj.delay += exports._libraryDelay; 99 | } 100 | return newObj; 101 | }; 102 | } 103 | 104 | --- 105 | 106 | #### Haskell 107 | 108 | [lang=haskell] 109 | recur_count k = 1 : 1 : zipWith recurAdd (recur_count k) (tail (recur_count k)) 110 | where recurAdd x y = k * x + y 111 | 112 | main = do 113 | argv <- getArgs 114 | inputFile <- openFile (head argv) ReadMode 115 | line <- hGetLine inputFile 116 | let [n,k] = map read (words line) 117 | printf "%d\n" ((recur_count k) !! (n-1)) 118 | 119 | 120 | *code from [NashFP/rosalind](https://github.com/NashFP/rosalind/blob/master/mark_wutka%2Bhaskell/FIB/fib_ziplist.hs)* 121 | 122 | --- 123 | 124 | ### SQL 125 | 126 | [lang=sql] 127 | select * 128 | from 129 | (select 1 as Id union all select 2 union all select 3) as X 130 | where Id in (@Ids1, @Ids2, @Ids3) 131 | 132 | *sql from [Dapper](https://code.google.com/p/dapper-dot-net/)* 133 | 134 | *** 135 | 136 | **Bayes' Rule in LaTeX** 137 | 138 | $ \Pr(A|B)=\frac{\Pr(B|A)\Pr(A)}{\Pr(B|A)\Pr(A)+\Pr(B|\neg A)\Pr(\neg A)} $ 139 | 140 | *** 141 | 142 | ### The Reality of a Developer's Life 143 | 144 | **When I show my boss that I've fixed a bug:** 145 | 146 | ![When I show my boss that I've fixed a bug](http://www.topito.com/wp-content/uploads/2013/01/code-07.gif) 147 | 148 | **When your regular expression returns what you expect:** 149 | 150 | ![When your regular expression returns what you expect](http://www.topito.com/wp-content/uploads/2013/01/code-03.gif) 151 | 152 | *from [The Reality of a Developer's Life - in GIFs, Of Course](http://server.dzone.com/articles/reality-developers-life-gifs)* 153 | 154 | *) --------------------------------------------------------------------------------