Skip to content

Instantly share code, notes, and snippets.

View wenpeng's full-sized avatar

Wenpeng wenpeng

  • China · Shanghai
View GitHub Profile
<script type="text/javascript">
// Not Required
var gSound = 'A background-music.mp3 URL';
var playsound = function()
{
var audio = new Audio();
audio.loop = true;
audio.src = gSound;
document.body.appendChild(audio);
audio.play();
@extraordinaire
extraordinaire / reconnecting_pdo.php
Last active June 27, 2023 11:12
Reconnectable PDO
<?php
class ReconnectingPDO
{
protected $dsn, $username, $password, $pdo, $driver_options;
public function __construct($dsn, $username = "", $password = "", $driver_options = array())
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
@komlenic
komlenic / DOMElement.innerHTML.php
Created November 17, 2011 18:54
Get innerHTML of a php DOMElement
<?php
// See http://www.php.net/manual/en/class.domelement.php#101243
function get_inner_html( $node ) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;