Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Gee andyg2

  • 74GEE
  • Dumaguete City, Philippines
View GitHub Profile
View watermark-image-uploads.php
<?php
/*
* Plugin Name: WordPress.com Watermark Image Uploads
* Author: Alex Mills
* Author URI: http://automattic.com/
*/
class WPcom_Watermark_Uploads {
public $watermark;
@andyg2
andyg2 / jsTable.js
Last active May 29, 2021
Generates an HTML table from an arbitrary JavaScript object
View jsTable.js
function render_jsTable(jsTable) {
// build arbitrary HTML table from object
var html = [];
var table = $("<table>");
var thead = $("<thead>").appendTo(table);
var tbody = $("<tbody>").appendTo(table);
if (jsTable.tableData.table) {
$.each(jsTable.tableData.table, function (key, val) {
@andyg2
andyg2 / parse_jquery_sortable.php
Created Aug 27, 2019
Full circle jquery sortable structure to flat array and back to nested.
View parse_jquery_sortable.php
<?php
//updated gist for additional array wrapping and empty children arrays (required)
$json = '[{
"name": "Item 1",
"id": 0,
"children": [
[]
]
@andyg2
andyg2 / parse_nestable.php
Last active Aug 26, 2019
Full circle nestable js structure to flat array and back to nested.
View parse_nestable.php
<?php
$json = '[{
"id": 8,
"text": 8,
"children": [{
"id": 3,
"text": 3,
"children": [{
"id": 1,
"text": 1,