Skip to content

Instantly share code, notes, and snippets.

@willdages
willdages / slack-interactive-messages-api-gateway-mapping-template.vtl
Last active March 6, 2024 07:37
Slack's Interactive Messages endpoint reports a Content-Type of `application/x-www-form-urlencoded` but responds with something like looks like `payload=%7B%22actions%22%3A%5B%7B%22...`, which is encoded JSON inside the payload parameter, which takes the API Gateway VTL templates for a loop.
## The `substring(8)` returns the input with everything after "payload=" which is the only parameter passed in,
## everything else is encoded JSON inside that parameter.
#set ($encodedJSON = $input.body.substring(8))
$util.urlDecode(${encodedJSON})
# Tail Laravel and Webserver (NGINX & Apache 2) log files
# Compatible with Laravel 4 & 5
#
alias tl="ls -d /var/log/nginx/* /var/log/apache2/* storage/logs/* app/storage/logs/* storage/laravel.log | grep -v 'gz$' | grep -v '1$' | xargs tail -f"
@niraj-shah
niraj-shah / fb-post-extended-4.0.x.php
Created May 29, 2014 10:10
Posting to Timeline using PHP SDK 4.0.x with additional parameters
<?php
// make api call
$response = (new FacebookRequest(
$session, 'POST', '/me/feed', array(
'name' => 'Facebook API: Posting a Status Update Using PHP SDK 4.0.x',
'caption' => "I'm rewriting old tutorials to work with the new PHP SDK 4.0 and Graph API 2.0.",
'link' => 'https://www.webniraj.com/2014/05/29/facebook-api-p…-php-sdk-4-0-x/',
'message' => 'Check out my new tutorial'
)