Skip to content

Instantly share code, notes, and snippets.

View levizwannah's full-sized avatar
💭
Coding

Levi Kamara Zwannah levizwannah

💭
Coding
View GitHub Profile
@stampycode
stampycode / push.php
Last active May 28, 2021 00:18
Create a ServiceWorker Push notification in PHP
<?php
/*
* If you get any part of this process wrong, Google gives the really helpful error message "invalid JWT provided".
*
* Mozilla (Firefox) gives a slightly just-as-useful error:
* {
* "code": 401, "errno": 109, "error": "Unauthorized",
* "more_info": "http://autopush.readthedocs.io/en/latest/http.html#error-codes",
* "message": "Request did not validate Invalid Authorization Header"
@meetrajesh
meetrajesh / binary_search_tree.php
Last active January 18, 2022 16:53
An efficient binary search tree (BST) implementation in PHP.
<?php
class BinarySearchTree {
private $_root;
public function __construct() {
// setup sentinal node
$this->_root = new BinarySearchNode(null);
}
public function getRoot() {
return $this->hasNode() ? $this->_root->right : null;