Skip to content

Instantly share code, notes, and snippets.

<?php
function buildHierarchy(&$results, $parent = 0, $level = 0)
{
global $modx;
$children = array_values($modx->getChildIds($parent, 1));
$level = $level + 1;
foreach($children as $child)
{
$descendents = array_values($modx->getChildIds($child, 100));
<?php
/*
How to use:
Get this british words dictionary from here: http://www.curlewcommunications.co.uk/wordlist.html
IN PHP install the mypeb extension from source:
http://code.google.com/p/mypeb/
@fdmanana
fdmanana / gist:832610
Created February 17, 2011 20:27
The CouchDB replicator database

1. Introduction to the replicator database

A database where you PUT/POST documents to trigger replications and you DELETE to cancel ongoing replications. These documents have exactly the same content as the JSON objects we used to POST to /_replicate/ (fields "source", "target", "create_target", "continuous", "doc_ids", "filter", "query_params".

Replication documents can have a user defined "_id". Design documents (and _local documents) added to the replicator database are ignored.

The default name of this database is _replicator. The name can be changed in the .ini configuration, section [replicator], parameter db.

2. Basics

@mtigas
mtigas / gist:952344
Last active April 3, 2024 07:57
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@cfaulkingham
cfaulkingham / mysql_to_couchdb.js
Created July 21, 2011 18:14
This is a script to convert a MySQL table to a CouchDB database.
/*
Copyright (C) 2011 Colin Faulkingham, http://3a2d29.com/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@mojavelinux
mojavelinux / Writing Tools Writeup.markdown
Created January 30, 2012 18:56 — forked from matthewmccullough/Writing Tools Writeup.md
How To Write A Technical Book (One Man's Modest Suggestions)
@dazld
dazld / hierarchy.php
Created March 23, 2012 19:43 — forked from devi/hierarchy.php
MySQL "Closure Table" for CodeIgniter based on Bill Karwin design.
<?php
/**
*
* CI / MySQL Closure Table Model
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@yefuchs
yefuchs / gfw_contributors.md
Last active March 4, 2024 05:24
GFW Contributers

#The Great Firewall (GFW) Contributors List

注:数据来源为 dblp 和 cndblp, 下面括号中的数字表示 dblp 中显示的跟方滨兴合作论文的数量

###Binxing Fang (方滨兴)

中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网络方向首席科学家
http://en.wikipedia.org/wiki/Fang_Binxing

@deletosh
deletosh / LaravelHierarchy
Created May 8, 2013 20:25
Using Closure Table ( for Hierarchical Data -- breadcrumbs, threaded comments, etc ) in Laravel 4 / MySQL
<?php
namespace Geleyi\Helpers;
use Illuminate\Support\Facades\DB;
/**
* Class Hierarchy
*