Skip to content

Instantly share code, notes, and snippets.

View vistik's full-sized avatar

Visti Kløft vistik

  • Copenhagen
View GitHub Profile
@vistik
vistik / gist:d088e56e16866f056456
Created October 9, 2014 14:35
Laravel forge post to slack channel on deploy
SHA=$(git rev-parse --verify HEAD)
SHA="==== NEW DEPLOY ==== \n\n https://github.com/<USERNAME>/<REPO>/commit/$SHA deployed to http://<site.project.com> \n"
curl -X POST --data-urlencode 'payload={"channel": "#devops", "username": "Laravel Forge", "text": "'"$SHA"'", "icon_emoji": ":shipit:"}' https://<USERNAME>.slack.com/services/hooks/incoming-webhook?token=<TOKEN>
@vistik
vistik / JsonBodyRequest.php
Created March 16, 2015 12:06
Laravel 5 - Use form request to validate JSON body
<?php
namespace <YourNamespace>\Http\Requests;
// To validate the content of the JSON body instead of query params, you need to override the getValidatorInstance() method to create the validator instance with $this->json()->all() instead for $this->all()
// This way you can keep your Requests as is and just extend this class instead when you need to validate jsonbody instead of query params
abstract class JsonBodyRequest extends Request{
/**
@vistik
vistik / index.html
Created January 19, 2019 20:13
docs ../tmp/YE41cvYUeSJCywIu.json
{"swagger":"2.0","info":{"description":"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.","version":"1.0.0","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["https","http"],"paths":{"/pet":{"post":{"tags":["pet"],"summary":"Add a new pet to the store
@vistik
vistik / index.html
Created January 19, 2019 20:14
docs ../tmp/hMnJQcwxab0iodON.json
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Swagger Petstore</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<script>
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
@vistik
vistik / index.html
Created January 19, 2019 20:15
docs ../tmp/QlnJasuRQgBr1iqV.json
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Swagger Petstore</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<script>
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
@vistik
vistik / index.html
Created January 19, 2019 20:19
docs ../tmp/DVKTxs0WJUzDIDvj.json
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Swagger Petstore</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<script>
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
@vistik
vistik / index.html
Created January 19, 2019 20:19
docs ../tmp/4G0RNHykVSwAGuFG.json
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Swagger Petstore</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<script>
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
@vistik
vistik / index.html
Created January 19, 2019 21:19
docs ../tmp/OfBKtO1Ha70p7ElW.json
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Swagger Petstore</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<script>
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
@vistik
vistik / index.html
Created January 19, 2019 21:21
docs ../tmp/bmEqyk1pWCXJVEit.json
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Swagger Petstore</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<script>
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
@vistik
vistik / swagger.json
Created January 19, 2019 21:24
tmp ../tmp/m11X76tg1ya5OUVH.json
{"swagger":"2.0","info":{"description":"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.","version":"1.0.0","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["https","http"],"paths":{"/pet":{"post":{"tags":["pet"],"summary":"Add a new pet to the store