Skip to content

Instantly share code, notes, and snippets.

View mackensen's full-sized avatar

Charles Fulton mackensen

View GitHub Profile
@plembo
plembo / gitpython-clone-git.md
Last active September 19, 2024 02:17
Clone git repo using GitPython

Git clone using GitPython

In general, I find GitPython's doc to be difficult to parse, mostly because the examples are written in the same kind of manpage notation that gave me a steep learning curve back when I was first learning Unix.

After searching for awhile, I found this page of the doc that tries to show how to clone a remote repo:

https://gitpython.readthedocs.io/en/stable/tutorial.html#examining-references

I didn't find it that obvious, and had to do some trial and error in the python shell before I got it right.

Here's an actual working example you can try:

@westonruter
westonruter / force_balance_tags2.php
Last active September 5, 2024 01:50
Use DOMDocument to do a more robust job at force_balance_tags.
<?php
/**
* Use DOMDocument to do a more robust job at force_balance_tags.
*
* "force_balance_tags() is not a really safe function. It doesn’t use an HTML parser
* but a bunch of potentially expensive regular expressions. You should use it only if
* you control the length of the excerpt too. Otherwise you could run into memory issues
* or some obscure bugs." <http://wordpress.stackexchange.com/a/89169/8521>
*