Today i ran into a PHP gotcha, and it had me stumped for a few minutes so i thought i'd share it with you.
$found = false;
foreach($arr as &$item) {
if ($item['type'] == "mytype") {
$found = true;
break;
}
}
$filename = "tortoisehg-2.9.1-hg-2.7.1-x64.msi" | |
$source = "http://bitbucket.org/tortoisehg/files/downloads/$filename" | |
$destination = ".\$filename" | |
write-host "`nDownloading $source to $destination." | |
$wc = New-Object System.Net.WebClient | |
$wc.DownloadFile($source, $destination) |
diff --git a/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs b/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs | |
--- a/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs | |
+++ b/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs | |
@@ -25,6 +25,7 @@ | |
public class RouteController : Controller { | |
private readonly IContentDefinitionManager _contentDefinitionManager; | |
private readonly IOrchardServices _orchardServices; | |
+ private readonly ITransactionManager _transactionManager; | |
private readonly ISessionFactoryHolder _sessionFactoryHolder; | |
private readonly ShellSettings _shellSettings; |
-- VALUE | |
import { JsonValueInterest, LiveResource } from 'liveresource'; | |
class TimeValueInterest extends JsonValueInterest { | |
transform(obj) { | |
return obj.time; | |
} | |
} |
| value | changes | hint | multiplex | | |
--------+-----------+-----------+-----------+-----------+ | |
plain | no (*1) | yes | no (*2) | no | | |
wait | yes | yes | no (*3) | yes | | |
socket | no | no | no | yes | | |
stream | yes | yes | yes | no | | |
--------+-----------+-----------+-----------+-----------+ | |
*1 - The current value of a value resource is simply the result of a simple GET to the resource. |
Today i ran into a PHP gotcha, and it had me stumped for a few minutes so i thought i'd share it with you.
$found = false;
foreach($arr as &$item) {
if ($item['type'] == "mytype") {
$found = true;
break;
}
}
The following is a demo that uses the fetch API in a browser to subscribe to messages streamed through a GRIP Stream pushed through a sample server that is proxied behind the open-source Pushpin (https://pushpin.org/) server.
To run the demo:
git clone https://github.com/fanout/js-grip
cd js-grip
<?php | |
function flattenExceptionBacktrace(\Exception $exception) { | |
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace'); | |
$traceProperty->setAccessible(true); | |
$flatten = function(&$value, $key) { | |
if ($value instanceof \Closure) { | |
$closureReflection = new \ReflectionFunction($value); | |
$value = sprintf( | |
'(Closure at %s:%s)', |