Skip to content

Instantly share code, notes, and snippets.

@michaelphipps
michaelphipps / ably-jwt-authentication-send-json.php
Created Mar 6, 2021
Send a JSON message with Ably.com using JWT Authentication in PHP without using the official Ably PHP SDK.
View ably-jwt-authentication-send-json.php
<?php
// $ composer require lcobucci/jwt
require __DIR__ . '/vendor/autoload.php';
use Lcobucci\JWT\Configuration;
use Lcobucci\JWT\Signer\Key\InMemory;
use Lcobucci\JWT\Signer\Hmac\Sha256;
@michaelphipps
michaelphipps / how-to-pass-data-to-partials-in-handelbars-php.md
Last active Oct 23, 2020
How to pass data to partials in Handlebars.php
View how-to-pass-data-to-partials-in-handelbars-php.md

How to pass data to partials in Handlebars.php

The way data is passed in partials in salesforce/handlebars-php isn't the same as it is over at handlebars.js

Inspired by this issue

In this gist, we have a dataset of names that we want to display on a page. We are using a partial to format the display of the names to avoid writing repetitive code.

[
 "names"=&gt;[
@michaelphipps
michaelphipps / web-font-not-working.md
Last active May 27, 2018
How to get web fonts working correctly in your server environment.
View web-font-not-working.md

If you have web fonts on a subdomain seperate to the domain you are calling them, usual advice is to place the following into the .htaccess file for the subdomain

<IfModule mod_headers.c>
  <FilesMatch “.(eot|otf|ttc|ttf|woff|woff2)$”>
    Header set Access-Control-Allow-Origin “*”
  </FilesMatch>  
</IfModule>
View apiexplorer.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="" name="description">
<meta content="" name="author">
<link href="../../favicon.ico" rel="icon">
<title>JSON API Explorer</title><!-- Latest compiled and minified CSS -->
View keybase.md

Keybase proof

I hereby claim:

  • I am michaelphipps on github.
  • I am michaelphipps (https://keybase.io/michaelphipps) on keybase.
  • I have a public key whose fingerprint is FAE5 1CEC F182 EB36 BB3E 4BAD AFC5 0520 8CDF C98D

To claim this, I am signing this object: