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
// The Type | |
function Maybe(){}; | |
// `Nothing` Type Constructor | |
function Nothing() { | |
this.value = null; | |
}; | |
// `Just` Type Constructor | |
function Just(value) { |
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 housePrice = 15000; | |
var buyCoke = setupPrice('coke', 50); | |
var buyHotDog = setupPrice('hot-dog', 150); | |
var buyHouse = setupPrice('house', housePrice); | |
var salary = 500; | |
var getPaid = modifyState(sum.bind(null, salary)); | |
var saveForHouse = replicate( Math.floor(housePrice / salary), getPaid); |
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
module Main where | |
import Control.Monad.State.Lazy | |
step start stop (currentValue, modifier) = (currentValue, newState) | |
where reverseModifier = (currentValue + modifier > stop) || (currentValue + modifier < start) | |
modifier' = if reverseModifier | |
then | |
-modifier | |
else |
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
<!doctype html> | |
<html> | |
<head> | |
<!-- ALL OTHER FILES --> | |
<style> | |
.green { | |
color: green; | |
} | |
</style> | |
<script src="jquery-1.11.1.js"></script> |
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
module Main where | |
import Control.Monad.State (StateT(..), runStateT, modify, get) | |
import Control.Monad.Reader (ReaderT(..), runReaderT, ask) | |
import Control.Monad.Trans.Class (lift) | |
import Control.Monad.IO.Class (liftIO) | |
type MySuperMonad = ReaderT String (StateT Int IO) |
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
Shoes.app(:title => 'FTP File Uploader', :width => 500, :height => 400, :resizable => false) do | |
require 'net/ftp' | |
background gradient rgb(255, 255, 255), rgb(150, 150, 150), :angle => 45 | |
stack :margin => 20 do | |
end | |
end |
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
Shoes.app(:title => 'FTP File Uploader', :width => 500, :height => 400, :resizable => false) do | |
require 'net/ftp' | |
background gradient rgb(255, 255, 255), rgb(150, 150, 150), :angle => 45 | |
stack :margin => 20 do | |
caption 'FTP File Uploader' | |
flow :margin => 3 do |
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
Shoes.app(:title => 'FTP File Uploader', :width => 500, :height => 400, :resizable => false) do | |
require 'net/ftp' | |
background gradient rgb(255, 255, 255), rgb(150, 150, 150), :angle => 45 | |
stack :margin => 20 do | |
caption 'FTP File Uploader' | |
flow :margin => 3 do |
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.List | |
import Data.List.Split | |
import Data.Maybe | |
import Data.Char | |
{- | |
http://projecteuler.net/index.php?section=problems&id=22 | |
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score. |
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
tmp = Tempfile.new("out") | |
tmp << "things" | |
tmp.close | |
puts File.read(tmp.path) |
OlderNewer