Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| permute = (array) -> | |
| buf = [] | |
| return array if array.length == 1 | |
| for element, i in array | |
| buf.push [element] | |
| remaining = array.slice() | |
| remaining.splice(i, 1) | |
| subPermutations = permute(remaining) | |
| buf.concat subPermutations | |
| for sub in subPermutations |
| full_width = 80 | |
| columns = 12 | |
| gutter = 1 | |
| .container | |
| width unit(full_width, '%') | |
| margin auto | |
| overflow hidden | |
| div[class^="grid_"] |
| # Rationale: How to chain functions with type (a -> transformation_of_a) # | |
| # as they were (a -> a)? | |
| # | |
| # If the functions were "normal" (a -> a), we'd write simply: fun3(fun2(fun1(1))) | |
| def fun1(x): | |
| return ("ok", 1*x) if x > 1 else ("fail", "fun1: value of x is ugly: %s" % x) | |
| def fun2(x): | |
| return ("ok", 2*x) if x > 2 else ("fail", "fun2: value of x is ugly: %s" % x) |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| // Lack of tail call optimization in JS | |
| var sum = function(x, y) { | |
| return y > 0 ? sum(x + 1, y - 1) : | |
| y < 0 ? sum(x - 1, y + 1) : | |
| x | |
| } | |
| sum(20, 100000) // => RangeError: Maximum call stack size exceeded | |
| // Using workaround |
| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |
| # A chainable Either monad for Ruby | |
| # | |
| # Examples | |
| # | |
| # Either.right('s') >> proc { |s| Either.right(s + '-1') } >> proc { |s| Either.right(s + '-2') } | |
| # #=> #<Either @left=nil, @right="s-1-2"> | |
| # | |
| # Either.right('s') >> proc { |s| Either.left('error!') } >> proc { |s| Either.right(s + '-2') } | |
| # #=> #<Either @left='error!', @right=nil> | |
| # |