Skip to content

Instantly share code, notes, and snippets.

View arterm-sedov's full-sized avatar

arterm-sedov

View GitHub Profile
@arterm-sedov
arterm-sedov / ok_remove_all_posts.js
Last active March 31, 2024 11:34
A script to remove all posts from your ok.ru wall
(function ()
{
'use strict';
if (!confirm('Удалить все заметки со стены?')) return;
var deletePostLink = document.body.querySelectorAll('a.delete-stub_cancel');
for (var i = 0; i < deletePostLink.length; i++)
{
deletePostLink[i].click();
}
alert( 'удалено записей:'+deletePostLink.length);
(.*[а-яА-ЯёЁ]+.*)+
@arterm-sedov
arterm-sedov / gist:1a63ce4ebc4deaf3cd3f3a3b194f2c81
Created August 18, 2023 09:39
phpkb automatic TOC generation
<?php
function TableOfContents($depth)
{
$html_string = Articles_Detail('All');
//get the headings down to the specified depth
$pattern = '/<h[2-'.$depth.']+ id=".+"[^>]*>.*?<\/h[2-'.$depth.']>/';
$whocares = preg_match_all($pattern,$html_string,$winners);
//reformat the results to be more usable
<!DOCTYPE html>
<html>
<head>
<title>Copy Header Anchor</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
<div class="section">
<h1 id="section1">Section 1</h1>