Skip to content

Instantly share code, notes, and snippets.

@TNHSAesop
TNHSAesop / SearchEngineCrawlPsudeo.cs
Last active September 10, 2021 18:35
Puesdo Code For How A Search Engine Might Crawl The Web (Written in C#)
// start a loop that's always running
while (1 == 1)
{
// retrieve the next crawl target from a database or other persistent data store
string url = GetNextCrawlTarget();
// check to see if this URL has already been indexed, if it has, check to see if it has changed since last crawl and needs to be re-crawled
if (URLAlreadyIndexed(url) == false && URLUpdatedSinceLastCrawl(url) == false)
{
// crawl the url if there are links present within the document, extract them from the document and put them in a list of new potential crawl targets
@TNHSAesop
TNHSAesop / blockContactFormSpamByDisablePaste.js
Last active December 10, 2020 14:24
Block Contact Form Spam By Disabling Paste
// disable copy paste into text area fields to prevent spammers from blowing up forms
jQuery(document).on('YourEventTypicallyDocumentReady', function() {
// disable keyboard paste
jQuery('YourFormFieldSelector').bind("cut copy paste", function(e) {
e.preventDefault();
});
// disable context menu to prevent right click pasting
jQuery('YourFormFieldSelector').bind("contextmenu", function(e) {