1,751 karma · joined Mar 26, 2008 (18y ago) · 893 submissions
shaunxcode@gmail.com
comment 17y ago · link · parent
comment 17y ago · link · parent
comment 17y ago · link · parent
comment 17y ago · link · parent
function curry(){
$args = func_get_args();
$fn = array_shift($args);
return function() use(&$fn, &$args) {
$nargs = func_get_args();
foreach($nargs as $narg) $args[] = $narg;
return call_user_func_array($fn, $args);
};
}
$add20 = curry(function($a, $b){return $a + $b;}, 20);
echo $add20(5); #25673.
PHP 5.3 YCombinator and other tricks(commonphp.blogspot.com ↗)
2 points · by shaunxcode · 17y ago · discuss
comment 17y ago · link · parent
comment 17y ago · link · parent
On rice - I actually tried growing rice in my apartment using 5 gallon buckets one suspended in the other so that there is a constant supply of water in the bottom (I think the term is self watering container). I just threw in some soil and tossed a hand full of organic brown rice and it sprouted within the week! I am not sure how much I could have grown had I taken it past that point but I was surprised that it even sprouted!
comment 17y ago · link · parent
This is another great reason to source your food locally. When you are having to trace the contents of what is going into your mouth across state borders let alone oceans you're going to have some difficulty.
One of my long term plans is to open a restaurant which sources everything locally (with in the county) - it will be inherently vegan but will not champion that so as to not turn people off of the concept but rather push the idea of healthy food supporting local business and thus the overall food security for the community.
comment 17y ago · link · parent
Eating out is always going to be a compromise if you really care about what goes into your body. I would prefer to reserve it for when I am out of town or special occasions - but even then what is more special than actually taking the time to cook yourself?
comment 17y ago · link · parent
return join($delim, array_reverse(split($delim, $str)));
Or more ideally with a little fluidity, assuming a string object:
return $str->split($delim)->reverse()->join($delim);
comment 17y ago · link · parent
comment 17y ago · link · parent