Skip to content

Instantly share code, notes, and snippets.

View foxted's full-sized avatar
🦊

Valentin Prugnaud foxted

🦊
View GitHub Profile
@foxted
foxted / .travis.yml
Last active June 8, 2022 13:36
Unit test Laravel 4.2 packages in context with Travis CI (with SQLite testing database)
language: php
php:
- 5.4
- 5.5
- 5.6
before_install:
- composer self-update
- composer create-project laravel/laravel
@foxted
foxted / .travis.yml
Created June 4, 2014 09:46
Unit test Laravel 4.2 packages in context with Travis CI
language: php
php:
- 5.4
- 5.5
- 5.6
before_install:
- composer self-update
- composer create-project laravel/laravel
@foxted
foxted / pagination.php
Created July 18, 2014 02:36
Laravel 4: French default localization
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
@foxted
foxted / functions.php
Last active August 30, 2015 22:39
API Consumer ID & Consumer secret generator
<?php
function gen_oauth_creds() {
// Get a whole bunch of random characters from the OS
$fp = fopen('/dev/urandom','rb');
$entropy = fread($fp, 32);
fclose($fp);
// Takes our binary entropy, and concatenates a string which represents the current time to the microsecond
$entropy .= uniqid(mt_rand(), true);
@foxted
foxted / .travis.yml
Created October 2, 2014 13:55
Travis CI PHPSpec configuration
language: php
php:
- 5.4
- 5.5
- 5.6
- hhvm
before_script:
- travis_retry composer install --prefer-source --no-interaction --dev
@foxted
foxted / index.php
Created December 10, 2014 02:04
Max in array of objects
<?php
class Temperature{
private $temperature;
public function __construct($value){
$this->temperature = $value;
}
@foxted
foxted / nginx.conf
Last active October 19, 2015 08:37
nginx SSL
server {
server_name .example.com;
return 301 $scheme://www.example.com$request_uri;
}
@foxted
foxted / RedirectIfInsecure.php
Created October 19, 2015 08:26
Cloudflare flexible SSL detection in Laravel
<?php
namespace App\Http\Middleware;
use Closure;
class RedirectIfInsecure
{
/**
* Handle an incoming request.
@foxted
foxted / RouteServiceProvider.php
Created October 30, 2015 04:41
Read routes from any PHP file in app/Http/Routes folder.
<?php
namespace NW\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
@foxted
foxted / gulpfile.js
Created November 4, 2015 06:26
Vueify
elixir.config.js.browserify.transformers.push({
name: 'vueify'
});
elixir(function(mix) {
mix.browserify('main.js');
});
elixir.Task.find("browserify").watch("resources/**/*.vue");