Skip to content

Instantly share code, notes, and snippets.

@tedicela
tedicela / reverseLinkedList.php
Created November 15, 2019 17:31
Reversing a Singly LinkedList
<?php
function reverseLinkedList($l){
if($l == null){
return $l;
}
$reverse = clone $l;
$reverse->next = null;
@tedicela
tedicela / var_dump.js
Last active December 20, 2016 23:11
Debug function in Javascript like var_dump in PHP
/*
Debug function for Javascript like var_dump in PHP:
*/
function var_dump(obj, indent){
if(typeof indent == "undefined" ) indent="\n";
objType = typeof obj;
if(objType == "object" ){
str = "Object(";
@tedicela
tedicela / strip_single_tag.php
Last active December 9, 2016 14:42
Stripping certain xml/html tag from a string.
<?php
/*
//Usage:
$txt= '<h2>
<a
href="/w/index.php?title=Lorem_ipsum&amp;action=edit&amp;section=2"
title="Edit section: Discovery">edit< / a> <!-- This "a" will be stripped -->
<a href="/w/index.php?title=Lorem_ipsum&amp;action=edit&amp;section=2" title="Edit section: Discovery">edit< /a> <!-- This "a" will be stripped -->
<a href="/w/index.php?title=Lorem_ipsum&amp;action=edit&amp;section=2" title="Edit section: Discovery">edit</ a> <!-- This "a" will be stripped -->