Skip to content

Instantly share code, notes, and snippets.

<?php
public function run(Request $request)
{
$this->container = $this->container ?: new Container;
return call_user_func(
array_reduce(array_reverse($this->middlewares), function($stack, $middleware)
{
return function($request) use ($stack, $middleware)
@jasonlewis
jasonlewis / OAuth2Throttle.php
Last active August 29, 2015 14:05
Looking at an improved way of throttling API requests with the package. This will allow you to register custom throttles when you want to grant more requests for different types of authentication or user levels.
<?php
class OAuth2Throttle extends Dingo\Api\Http\RateLimit\Throttle
{
public function condition($app)
{
return $app['api.auth']->via('oauth2');
}
}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1lsK2MLd/epUCPyKgk4xb7/ac9mcTICA8T3X6bwsUV9FBxYGWSOmNfPc8muhz8JO7S8gSOxuiLmQQQQJFLcaQDENByKH6h588D42tJFphK6RDkQnUr0SF/whWe19stbdKRgnzBkOjOIyUqiAUjm9MEnbhnp0rP80ThXPHbqbAPs3HtMF9xvJkVUhFFj4EyeCSQJFbNz3E/max/KnlWsbpXWV7MHDhDR9Q/D03TSMu9wu7b3AMzQHhU+aNYorEqq9n/3HPyVwM0LOZec8fHZnHTOADgRHztsMteG2gx5hjbFu3cZDcNKH0+C+YwZ1UaCKFTvQ8xt0LvzMjPRMs6DCR dawnstar

Keybase proof

I hereby claim:

  • I am jasonlewis on github.
  • I am jasonlewis (https://keybase.io/jasonlewis) on keybase.
  • I have a public key whose fingerprint is E1E3 1A8D 1030 6D57 B915 4BDB 0FBC 321C 19B4 CDD4

To claim this, I am signing this object:

@jasonlewis
jasonlewis / post_comments.sql
Last active August 29, 2015 14:00
Dummy tables and data for API tutorial.
--
-- Table structure for table `post_comments`
--
CREATE TABLE IF NOT EXISTS `post_comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`body` text NOT NULL,
PRIMARY KEY (`id`),
KEY `post_id` (`post_id`)
@jasonlewis
jasonlewis / create-project.sh
Last active February 10, 2023 12:04
Bash script that creates a new project and virtual host for that project. Can also be used to quickly create a new Laravel project.
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {