Create a table to represent tree nodes.
CREATE TABLE `tree_node` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`data_body` text,
node_deleted datetime DEFAULT NULL,
| <?php | |
| /* | |
| * Source: http://goo.gl/p2GybZ | |
| */ | |
| // for object | |
| function buildTree($items) { | |
| $childs = array(); | |
| foreach($items as $item) |
| /* | |
| * Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js | |
| */ | |
| var http = require('http'), | |
| fs = require('fs'), | |
| util = require('util'); | |
| http.createServer(function (req, res) { | |
| var path = 'video.mp4'; |
| // example html | |
| <input type="file" id="upload" style="display:none" name="upload"> | |
| <button id="clik"> Click to Upload Video</button> | |
| //Start Upload | |
| function _(el) {//helper function | |
| return document.getElementById(el); | |
| } |
| /* Helper buddy for removing async/await try/catch litter 🗑 */ | |
| function O_o(promise) { | |
| return promise.then(data => { | |
| if (data instanceof Error) return [data] | |
| return [null, data] | |
| }).catch(err => [err]) | |
| } | |
| /* Look ma, no try/catch */ | |
| async function usageExample(params) { |
| const axios = require('axios'); | |
| const secretKey = "<PAYSTACK_SECRET_KEY>" | |
| const initializePaystack = async (form) => { | |
| const options = { | |
| url : 'https://api.paystack.co/transaction/initialize', |
| create database if not exists `worktern`; | |
| CREATE TABLE `users` ( | |
| `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
| `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | |
| `first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | |
| `last_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | |
| `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | |
| `email_verified_at` timestamp NULL DEFAULT NULL, |
| <?php | |
| function verify($reference) { | |
| $result = array(); | |
| //The parameter after verify/ is the transaction reference to be verified | |
| //you have to get reference from callback url if you are using paystack standard | |
| $url = 'https://api.paystack.co/transaction/verify/'. $reference; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <script src="https://js.paystack.co/v1/inline.js"></script> | |
| </head> |