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
| {-- | |
| - These functions handle the common scenario presented in introductory classes on Bayesian Inference. | |
| - | |
| --} | |
| type Probability = Double | |
| type Prior = Probability | |
| type AccuracyPos = Probability | |
| type AccuracyNeg = Probability | |
| type BayesianInf = Probability |
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
| var dict = process.argv[2], | |
| inputLetters = process.argv[3], | |
| words = require('fs') | |
| .readFileSync(dict, {encoding: 'utf8'}) | |
| .toLowerCase() | |
| .replace(/\/.+/g, '') | |
| .split(/\r\n/); | |
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
| module Main where | |
| import qualified Data.Map as Map | |
| import qualified Data.List as List | |
| import qualified Data.Ord as Ord | |
| main :: IO () | |
| main = interact $ prettyPrint . toSortedList . counts . List.words | |
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 qualified Data.ByteString.Lazy as BL | |
| import Data.Digest.Pure.MD5 | |
| import Data.Digest.Pure.SHA | |
| import System.Environment | |
| main = do | |
| args <- getArgs | |
| content <- BL.readFile $ args !! 0 | |
| putStrLn $ "SHA-1:\t\t" ++ (showDigest $ sha1 content) | |
| putStrLn $ "SHA-256:\t" ++ (showDigest $ sha256 content) |
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
| function allUnique(values) { | |
| return values.reduce(function (unique, next) { | |
| if (unique.indexOf(next) === -1) { | |
| unique.push(next); | |
| } | |
| return unique; | |
| }, []).length === values.length; |
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
| var fs = require('fs'), | |
| cfg = JSON.parse(fs.readFileSync('respawn.json', { encoding: 'utf8' })), | |
| now = new Date(), | |
| t_stamp = now.getFullYear() + '-' + | |
| (now.getMonth() + 1) + '-' + | |
| now.getDate(); | |
| function copy(source, target) { |
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
| <html> | |
| <head> | |
| <title>Excellent</title> | |
| <style type="text/css"> | |
| body { | |
| text-align: center; | |
| } | |
| </style> | |
| </head> | |
| <body> |
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
| module Main where | |
| import System.Environment(getArgs) | |
| type Value = Double | |
| type Operand = Value | |
| type Result = Value | |
| type BinaryOp = Operand -> Operand -> Result | |
| type Arguments = [String] | |
| type Stack = [Value] |
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
| var a = []; | |
| Object.defineProperty(a, '0', { | |
| get: function () { | |
| console.log("Here it is."); | |
| } | |
| }); | |
| a.push(10); | |
| void a[0]; // logs 'Here it is.'. |
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
| /* An extensible RPN calculator. | |
| * gcc -std=c99 -Wall -Wextra -pedantic rpn.c -o rpn | |
| * | |
| * example: ./rpn 10 20 / 2 "*" -> 1.00 | |
| */ | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> |
NewerOlder