Skip to content

Instantly share code, notes, and snippets.

View frankdejonge's full-sized avatar

Frank de Jonge frankdejonge

View GitHub Profile
### Keybase proof
I hereby claim:
* I am FrenkyNet on github.
* I am frenkynet (https://keybase.io/frenkynet) on keybase.
* I have a public key whose fingerprint is 3ED4 AF00 97B3 C922 5340 D2F6 5276 297F FD01 F1D8
To claim this, I am signing this object:
---
suites:
some_suite:
namespace: Name\Space
psr4_prefix: Name\Space
var gulp = require('gulp');
var spawn = require('child_process').spawn;
var subprocess;
function refreshGulpfile() {
if (subprocess) subprocess.kill();
subprocess = spawn('gulp', ['watched-default'], {stdio: 'inherit'});
}
gulp.task('default', function () {
@frankdejonge
frankdejonge / gist:5c19f8e7ce329dbcc1ef
Created June 10, 2014 18:38
Flysystem and user downloads
<?php
$stream = $fs->readStream($file);
// send the right headers
header("Content-Type: " . $fs->getMimetype($file));
header("Content-Length: " . $fs->getSize($file));
header("Content-disposition: attachment; filename=\"" . basename($file) . "\"");
// dump the attachement and stop the script
<?php
use GuzzleHttp\Post\PostFile;
$request = $client->createRequest('POST', 'http://example.com/');
$postBody = $request->getBody();
$readStream = $flysystem->readStream($fileLocation);
$postBody->addFile(new PostFile('test', $readStream);
$response = $client->send($request);
@frankdejonge
frankdejonge / composer.json
Created September 24, 2014 16:48
PSR-0 folder structure with PSR-4 autoloading.
{
"autoload": {
"psr-4": {
"Vendor\\Package\\": "src/Vendor/Package"
}
}
}
@frankdejonge
frankdejonge / gulpfile.js
Created October 6, 2014 13:37
Basic Gulp setup with Sass + Bower + Browserify
var gulp = require('gulp'),
browserify = require('gulp-browserify'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
jshint = require('gulp-jshint');
gulp.task('javascript', function () {
return gulp.src('assets/js/*.js')
.pipe(browserify({
@frankdejonge
frankdejonge / example.php
Created November 5, 2014 21:29
Write to dropbox example
<?php
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Dropbox;
use League\Flysystem\Adapter\Local;
$dropbox = new Filesystem(new Dropbox($client, 'dropbox/root/dir'));
$local = new Filesystem(new Local('loca/root/path'));
$dropbox->write('destination.ext', $local->read('relative/path/to/file.ext'));
<?php
function append_to_file($location, $contents)
{
$handle = fopen($location, 'a');
defer fclose($handle);
// stuff stuff
frwite($handle, $contents);
}
<?php
class DomainListener
{
public function handle(EventInterface $event)
{
// PASS
}
public function handle(DomainEvent $event)