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
$script = <<SCRIPT | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list | |
sudo apt-get update | |
sudo apt-get install -y mono-complete | |
sudo apt-get install -y automake libtool curl unzip | |
curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C /usr/local/src | |
cd /usr/local/src/libuv-1.4.2 | |
sudo sh autogen.sh | |
sudo ./configure |
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
let rec quickSort l = | |
match l with | |
| [] -> [] | |
| x::xs -> xs |> List.partition (fun y -> y < x) |> function (ltx,gtx) -> (quickSort ltx)@x::quickSort gtx |
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
open System | |
open System.Windows.Forms | |
open System.Drawing | |
//************Number of cells and dimensions************ | |
let cellSide = 10 | |
let noOfCellsInOneDir = 16 | |
let side = cellSide * noOfCellsInOneDir | |
let totNoOfCells = pown noOfCellsInOneDir 2 | |
//***********Helper functions******************** | |
let mapMatrix matrix = (List.map >> List.map) matrix |
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 Basics | |
import Keyboard | |
import Random | |
--MODEL | |
background = {width = 500.0, height = 500.0, color = black} | |
paddle1 = {width = background.height/30, height = background.height/7, x = 20-background.width/2, y = 0.0} | |
paddle2 = {paddle1 | x <- background.width/2 - 20} | |
ball = {side = paddle1.height/5, x = 0, y = 0, vx = 1, vy = 0.3} | |
--UPDATE |
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 Keyboard | |
import Window | |
import Graphics.Input (Input, input, button, dropDown) | |
import Graphics.Input.Field (Content, noContent, field, defaultStyle, Forward, Backward) | |
-- MODEL | |
data Direction = North | East | South | West | |
type Robot = {x:Int, y:Int, dir:Direction} | |
type Board = [(Int,Int)] | |
type Game = {robot:Robot, board:Board} |
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 String | |
import Graphics.Input (Input, input) | |
import Graphics.Input.Field as Field | |
xaxis = segment (-150,-100) (150,-100) | |
yaxis = segment (-150,-100) (-150,100) | |
content : Input Field.Content | |
content = input Field.noContent | |
field = Field.field Field.defaultStyle content.handle id "Type here!" <~ content.signal |
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 List | |
import Mouse | |
import Window | |
--MODEL | |
defaultBall = {x = 0, y = 0, v = toFloat 0, angle = toFloat 0} | |
--UPDATE | |
location t b = { b | x <- b.x - t * b.v * cos b.angle, | |
y <- b.y - t * b.v * sin b.angle } |
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 Mouse | |
import Window | |
-- Mouse.isDown is true whenever the left mouse button | |
-- is pressed down and false otherwise. | |
--MODEL | |
type Points = [(Int,Int)] | |
--UPDATE |
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 Keyboard | |
keyToBool x = if x == 0 then False else True | |
sfx p = lift (\p -> p.x) p | |
signalX = sfx Keyboard.arrows | |
xArrowPulse = fpsWhen 10 (keyToBool <~ signalX) | |
main = lift asText xArrowPulse |
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 Random | |
import Mouse | |
import Keyboard | |
data Fruit = Apple | Orange | Banana | Melon | Guava | |
rand = Random.range 0 4 (Mouse.clicks) | |
fruit n = if | n == 0 -> Apple | |
| n == 1 -> Orange | |
| n == 2 -> Banana | |
| n == 3 -> Melon | |
| otherwise -> Guava |
NewerOlder