Skip to content

Instantly share code, notes, and snippets.

View ipalaus's full-sized avatar

Isern Palaus ipalaus

View GitHub Profile

Here's the base sanitizer:

<?php

namespace FooProject\Internal\Sanitizers;

abstract class BaseSanitizer
{
    /**
@dhrrgn
dhrrgn / status.conf
Created January 27, 2014 15:10
Nginx status endpoint.
server {
listen 80;
server_name localhost;
location /status {
access_log off;
default_type text/plain;
return 200 "alive";
}
}
@laracasts
laracasts / gulpfile.js
Last active February 10, 2024 10:57
Example Laravel-specific Gulpfile from Laracasts.com
var gulp = require('gulp');
var gutil = require('gulp-util');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css')
var coffee = require('gulp-coffee');
var exec = require('child_process').exec;
var sys = require('sys');
@dhrrgn
dhrrgn / functions.php
Created March 3, 2014 16:02
Slugify. Note: Requires PHP >= 5.4 and the Intl extension
<?php
function slugify($string, $toLower = true) {
$rules = "Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove;";
if ($toLower) {
$rules .= ' Lower();';
}
$string = transliterator_transliterate($rules, $string);
// Remove repeating hyphens and spaces (e.g. 'foo---bar' becomes 'foo-bar')
@alienlebarge
alienlebarge / 01-GruntJS-Patternlab-TYPO3.md
Last active August 29, 2015 13:57
How we use GruntJS with patternlab and TYPO3 TemplaVoilà
[www]
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
pm = dynamic
pm.max_children = 24
pm.start_servers = 2

Configure

xdebug.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
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 () {
@antonioribeiro
antonioribeiro / gist:96ce9675e5660c317bcc
Created July 23, 2014 21:49
Codeception, Javascript and Laravel Homestead

You can use Codeception to test Javascript, like DOM manipulations and Ajax requests. Out of the box it can manipulate DOM elements but can't execute Javascript code, like most testing frameworks. But it gives you the option to use a WebDriver, to connect to a headless browser, and mimic a user browsing your website. It gives you some options: Selenium2, ZombieJS and, the easiest to configure, PhantomJS.

This article covers the installation and usage of PhantomJS, and assumes you are using Laravel Homestead, but it will work on any relatively new Debian based distro, like Ubuntu 14.04.

###Install PhantomJS

Just run those commands to install it:

sudo apt-get update
<?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);