Skip to content

Instantly share code, notes, and snippets.

View artulloss's full-sized avatar

Adam Tulloss artulloss

View GitHub Profile
@artulloss
artulloss / partialSPA.js
Last active June 30, 2023 01:14
Make some of your links load content via AJAX instead of a full page load. Good for sections of a website without JavaScript events on them.
/**
* Partial SPA
* Make some of your links load content via AJAX instead of a full page load
*/
function partialSPA(config) {
const {
selectorWithContentAndLinks = "body", // Selector of the element containing the links and the content to replace
selectorToReplace = "body", // Selector of the element to replace
routes = [/./], // Routes to replace
reservedPaths = [], // Paths that should not be replaced
{{ $var }} - Echo content
{{ $var or 'default' }} - Echo content with a default value
{{{ $var }}} - Echo escaped content
{{-- Comment --}} - A Blade comment
@extends('layout') - Extends a template with a layout
@if(condition) - Starts an if block
@else - Starts an else block
@elseif(condition) - Start a elseif block
@endif - Ends a if block
@artulloss
artulloss / remove.js
Created June 30, 2022 15:36
Remove domain redirect from cache
// Go to the page that redirects
// Execute in console
fetch('https://iwanttoremovethis.com', {method: 'post'}).then(() => {})
// Enjoy ~
@artulloss
artulloss / email-regex.js
Last active February 23, 2022 21:46
Email Regex Javascript
// This is the same checks as the HTML5 email input form field as outlined in the link below.
// Email regex
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
function isEmail(email) {
// https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
const regex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
return regex.test(email)
}
@artulloss
artulloss / index.js
Last active January 13, 2022 02:18
Spam Jokes in discord server chat for grinding unbelievaboat money. This shouldn't be detectable / it's not a self bot. Requires selenium.
const {Builder, By, Key, until, Origin} = require('selenium-webdriver');
const JokeAPI = require('sv443-joke-api');
const url = "https://discord.com/channels/708291410612322345/708293571236593725"; // Page to load
const channelTitle = "💬・chat" // Do document.title on the page in browser
const random = (length = 8) => {
return Math.random().toString(16).substr(2, length);
};
@artulloss
artulloss / alert.js
Created December 9, 2021 14:58
Alert script, for testing script loading and XSS
alert("Test script loaded");
@artulloss
artulloss / html.js
Last active July 10, 2021 02:13
Simple HTML in JS
// Rather than writing document.createElement() to create HTML attributes, this function will do it for you
const html = (string, ...props) => {
if(props.length) {
let interpolatedString = "";
for(let i = 0; i < string.length; i++) {
if(props[i] !== undefined) {
interpolatedString += string[i] + props[i];
} else {
interpolatedString += string[i];
@artulloss
artulloss / antiClarifyBox.js
Last active December 3, 2020 23:32
This will block the clarify box that google uses to push messages to users with on Youtube.
// ==UserScript==
// @name Remove clarify box
// @namespace https://artulloss.dev
// @version 0.1
// @description Block youtubes "clarify box"
// @author artulloss
// @match https://*.youtube.com/*
// @grant none
// @updateURL
// @license MIT
<?php
const PATTERN = '~" translate="no">(.+)<\/a><\/div>~';
$time = time();
$today = strtotime(date('Y-m-d', $time));
$dateTime = (new DateTime())->setTimestamp($time - $today);
@artulloss
artulloss / update.sh
Created April 17, 2020 00:18
Easily update pocketmine! You can also choose the version to check out by doing ./update.sh <version>
rm PocketMine-MP.phar.old 2> /dev/null
mv ./PocketMine-MP.phar ./PocketMine-MP.phar.old
echo "Backup of old Pocketmine-MP.phar stored at Pocketmine-MP.phar.old"
if [ $# -eq 0 ] # Empty arguments
then
curl -s https://api.github.com/repos/pmmp/Pocketmine-MP/releases/latest \
| grep "browser_download_url.*phar" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -