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
ghci > takeWhile (6>) [1..10] | |
[1,2,3,4,5] | |
ghci > dropWhile (6>) [1..10] | |
[6,7,8,9,10] | |
ghci > span (6>) [1..10] | |
([1,2,3,4,5],[6,7,8,9,10]) |
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
Prelude> [1..10] | |
[1,2,3,4,5,6,7,8,9,10] | |
Prelude> take 10 $ iterate (+1) 1 | |
[1,2,3,4,5,6,7,8,9,10] | |
Prelude> take 10 $ enumFrom 1 | |
[1,2,3,4,5,6,7,8,9,10] | |
Prelude> enumFromThenTo 1 2 10 | |
[1,2,3,4,5,6,7,8,9,10] |
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
Prelude> take 10 [1..20] | |
[1,2,3,4,5,6,7,8,9,10] | |
Prelude> drop 10 [1..20] | |
[11,12,13,14,15,16,17,18,19,20] | |
Prelude> splitAt 7 [1..20] | |
([1,2,3,4,5,6,7],[8,9,10,11,12,13,14,15,16,17,18,19,20]) |
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
# modified from https://github.com/lifepillar/homebrew-alt/blob/master/duplicates/php.rb | |
require 'formula' | |
def mysql_installed? | |
`which mysql_config`.length > 0 | |
end | |
def postgres_installed? | |
`which pg_config`.length > 0 |
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
require 'formula' | |
class Ghc < Formula | |
homepage 'http://haskell.org/ghc/' | |
version '7.4.1RC1' | |
if ARGV.include? '--64bit' | |
url "http://www.haskell.org/ghc/dist/7.4.1-rc1/ghc-7.4.0.20111219-x86_64-apple-darwin.tar.bz2" | |
else | |
url "http://www.haskell.org/ghc/dist/7.4.1-rc1/ghc-7.4.0.20111219-i386-apple-darwin.tar.bz2" | |
end |
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
# https://gist.github.com/stylesheets/gist/embed.css | |
div#content .gist .gist-file { | |
border: none; | |
} | |
div#content .gist .gist-file .gist-data { | |
border-top-left-radius: 20px; | |
border-top-right-radius: 20px; | |
} |
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
> let a = [1, 2, 3] | |
> last $ a ++ [7] | |
7 | |
> let b = [3, 4, 5] | |
> last $ b ++ [6, 9] | |
9 | |
> let c = [6, 7, 8] | |
> last $ c ++ [10] | |
10 |
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
require 'formula' | |
def php_installed? | |
`which php`.length > 0 | |
end | |
def composer_reqs? | |
`curl -s http://getcomposer.org/installer | /usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off -- --check`.include? "All settings correct" | |
end |
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
<?php | |
function benchmark(callable $block) { | |
$start = microtime(true); | |
for ($i = 0; $i < 100000; ++$i) { | |
$block(); | |
} | |
$end = microtime(true); |
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
#!/bin/bash | |
BIN="" | |
if [ "$PHP" == "/usr/local/bin/php" ] | |
then | |
PHP="" | |
fi | |
BIN="/usr/local/php/$1/bin/php" |