Skip to content

Instantly share code, notes, and snippets.

@longseespace
longseespace / worker.js
Last active September 15, 2024 04:01
Cloudflare Worker Proxy
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const { pathname, search } = url;
var newPathname = pathname;
if (pathname.startsWith('/docs')) {
newPathname = pathname.replace('/docs', '');
@soulbliss
soulbliss / affiliateCookieRemover.js
Created April 6, 2024 15:20
Marc Louvion's script to nuke affiliate cookie
// Nuke 'em all
// Marc's tweet https://twitter.com/marc_louvion/status/1776629697046339969
import { useEffect } from 'react';
useEffect(() => {
let referral_url = new URL(window?.location?.href);
if (
referral_url?.searchParams?.has('gclid') &&
@KristofferEriksson
KristofferEriksson / useUndo.ts
Created January 31, 2024 11:34
A React hook that enhances your components with powerful undo/redo functionality
import { useCallback, useEffect, useRef, useState } from "react";
interface UseUndoHook<T> {
value: T;
onChange: (newValue: T) => void;
undo: () => void;
redo: () => void;
clear: () => void;
canUndo: boolean;
canRedo: boolean;
@adrianhorning08
adrianhorning08 / googleMaps.js
Created August 4, 2023 23:17
Scrape Google Maps
import * as cheerio from "cheerio";
import puppeteerExtra from "puppeteer-extra";
import stealthPlugin from "puppeteer-extra-plugin-stealth";
import chromium from "@sparticuz/chromium";
async function searchGoogleMaps() {
try {
const start = Date.now();
puppeteerExtra.use(stealthPlugin());
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
//send and display response data from an api or webhook
add_action('wpcf7_before_send_mail', 'send_to_api_webhook', 10, 3);
function send_to_api_webhook($contact_form, &$abort, $submission)
{
// replace your-subject with your form field
$get_input_user = $submission->get_posted_data('your-subject');
@eliasdabbas
eliasdabbas / score_links.py
Last active September 20, 2022 12:26
Score internal links using two columns of "Source" and "Destination". This calculates various link importance metrics link degree centrality, betweenness centrality and PageRank.
<?php
Builder::macro('deferredPaginate', function ($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) {
$model = $this->newModelInstance();
$key = $model->getKeyName();
$table = $model->getTable();
$paginator = $this->clone()
// We don't need them for this query, they'll remain
// on the query that actually gets the records.
from bs4 import BeautifulSoup
import re
import requests
import heapq
from nltk.tokenize import sent_tokenize,word_tokenize
from nltk.corpus import stopwords
url = str(input("Paste the url"\n"))
num = int(input("Enter the Number of Sentence you want in the summary"))
num = int(num)