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,
| import { Knex } from 'knex' | |
| export async function up(knex: Knex): Promise<any> { | |
| await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => { | |
| table.integer('foobar'); | |
| }); | |
| } | |
| export async function down(knex: Knex): Promise<any> { | |
| await knex.schema.dropTable('test_setup'); |
| { | |
| "event": "charge.success", | |
| "data": { | |
| "id": 84, | |
| "domain": "test", | |
| "status": "success", | |
| "reference": "9cfbae6e-bbf3-5b41-8aef-d72c1a17650g", | |
| "amount": 50000, | |
| "message": null, | |
| "gateway_response": "Approved", |
| /* 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) { |
| /* | |
| * 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'; |
| <?php | |
| /* | |
| * Source: http://goo.gl/p2GybZ | |
| */ | |
| // for object | |
| function buildTree($items) { | |
| $childs = array(); | |
| foreach($items as $item) |