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
formatMsg = (function (original) { | |
return function (entry) { | |
additinalWork(); | |
return original.apply(this, arguments); | |
}; | |
})(formatMsg); |
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
{ | |
"repositories":[ | |
{ | |
"type":"hg", | |
"url":"ssh://[email protected]/pqr/light4" | |
} | |
], | |
"require":{ | |
"light/light4":"dev-default" | |
}, |
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
{ | |
"name":"light/light4", | |
"version":"1.0.0", | |
"require":{ | |
"php":">=5.4.0", | |
"silex/silex": "1.0.*@dev", | |
"twig/twig":">=1.8,<2.0-dev", | |
"monolog/monolog":">=1.0.0", | |
"symfony/validator":"2.1.*", | |
"symfony/console":"2.1.*" |
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
<?php | |
/* php скрипт в императивном стиле для статьи http://pqr7.wordpress.com/2014/09/03/haskell-vs-php/ */ | |
function splitPerBlock(array $lines) { | |
$blocks = []; | |
//Перебираем линии, отрезая от начала массива $lines найденные блоки. В итоге массив $lines станет пустым, а массив | |
//$linesPerBlock наполнится данными | |
while ($lines) { | |
//Если текущий блок начинается со строки, которая содержит "Container No.", удаляем эту строку | |
if (strpos($lines[0], 'Container No.') !== false) { |
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 | |
{- программа на Haskell для статьи http://pqr7.wordpress.com/2014/09/03/haskell-vs-php/ -} | |
import qualified Data.Text as T -- | |
import Data.List | |
parse :: String -> [[String]] | |
parse text = splitPerBlocks $ getLines text |
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
<?php | |
/* php скрипт в функциональном стиле (калька с Haskell) для статьи http://pqr7.wordpress.com/2014/09/03/haskell-vs-php/ */ | |
ini_set('xdebug.max_nesting_level', 200000); | |
function parse($text) { | |
return splitPerBlocks(getLines($text)); | |
} | |
function getLines($text) { |
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
B/L no. Container No. From To Vessel | |
868026836 | |
TRLU6921946 | |
Toys, games | |
in 1× 40ft High Cube Dry | |
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
<?php | |
/* скрипт для запуска тестов для стати http://pqr7.wordpress.com/2014/09/03/haskell-vs-php/ */ | |
function runTest($cmd, $content) { | |
$time = microtime(true); | |
$descriptorspec = []; | |
$descriptorspec[0] = ['pipe', 'r']; //stdin | |
$descriptorspec[1] = ['pipe', 'w']; //stdout |
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
Нфк код физики 075 | |
Писалось сами знаете когда ;) в детстве. Мне стыдно :) но сами просили... | |
// ----------------------------------------------------------------------------- | |
procedure playermove(i : byte); | |
var Msg: TMP_IamRespawn; | |
Msg2: TMP_GauntletState; | |
Msg3: TMP_SoundData; | |
Msg4: TMP_049t4_ShaftEnd; | |
Msg5: TMP_SV_PlayerRespawn; |
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
(require '[leiningen.exec :as le]) | |
(ns foo | |
(:require [clojure.string :as str])) | |
(def source-text "https://gist.githubusercontent.com/pqr/0cf155de6b8f95c3c400/raw/56fc9aa6c06bf3e55a2a02d3e4a857580feff2bc/haskell_vs_php_example.txt") | |
(defn get-lines [text] (map str/trim (str/split-lines text))) | |
(defn drop-header-line [lines] | |
(if (re-find #"Container No\\." (first lines)) |
OlderNewer