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 Control.Concurrent | |
import Control.Concurrent.Async | |
import System.Random | |
delayedOutput :: String -> IO () | |
delayedOutput m = do | |
gen <- newStdGen | |
let (t, _) = randomR (1, 10) ge | |
-- delay in microseconds | |
threadDelay (t * 1000000) |
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 Control.Concurrent | |
import Control.Concurrent.Chan | |
import System.Random | |
delayedOutput :: String -> Chan String -> IO () | |
delayedOutput m c = do | |
gen <- newStdGen | |
let (t, _) = randomR (1, 10) gen | |
-- delay in microseconds |
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 ConceptCode ( | |
up, | |
down | |
) where | |
import Control.Monad | |
import Data.List | |
{- |
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 Control.Monad | |
import Data.List | |
-- !! TODO: обернуть всю эту красоту в модуль, мб отдельные типы данных добавить | |
{- | |
Супер классная штука для формирования списка списков %) | |
Да, ее надо запомнить |
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) |
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
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
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 |
NewerOlder