Skip to content

Instantly share code, notes, and snippets.

View m4tthumphrey's full-sized avatar
🏂
Working...

Matt Humphrey m4tthumphrey

🏂
Working...
View GitHub Profile
@m4tthumphrey
m4tthumphrey / streamed.php
Last active December 28, 2022 08:06
Laravel response macro for streamed responses with seeking support
<?php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,
/* @var Full\Path\To\Namespace\Document $document */
$document = Document::create();
➜ windsor git:(master) ✗ npm update --loglevel=silly
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/Cellar/node/0.10.21/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'update',
npm verb cli '--loglevel=silly' ]
npm info using [email protected]
npm info using [email protected]
npm info outdated updating []
npm verb exit [ 0, true ]
getZones: function(temp) {
return temp ? this.state.tempZones : this.state.zones;
},
componentDidMount: function() {
this.setState({
zones: this.getFeatureData('zones'),
tempZones: this.getFeatureData('zones')
});
},
addZone: function() {
// ..
submitSettings: function(e) {
e.preventDefault();
console.log($(e.target).serialize());
},
render: function() {
//...
<form action="/validate" method="post" onSubmit={this.submitSettings}>
// ...
}
var ToolboxBlock = React.createClass({
handleClick: function() {
// need to reference the div here
},
render: function() {
var type = this.props.type;
var className = 'block block-type-'+type;
var blockId = 'block-'+Math.random();
return (
var Toolbox = React.createClass({
render: function() {
return (
<div></div>
);
}
});
React.renderComponent(
$time = '2014-03-30 02:00:00';
echo strtotime($time)."\n";
$time = '2014-03-30 01:00:00';
echo strtotime($time)."\n";
matth@darwin:~$ which node
matth@darwin:~$ sudo -s
root@darwin:~# which node
/home/matth/local/bin/node
data = $('#form').serialize();
$.ajax({
type: "POST",
url: "send.php?"+data,