Skip to content

Instantly share code, notes, and snippets.

Pieter Levels levelsio

View GitHub Profile
levelsio / getRandomFollower.php
Created Jan 11, 2020
get random Twitter follower from your exported followers.js
View getRandomFollower.php
// str_replace removes the JS part and makes it into a normal JSON file
$followers=json_decode(str_replace('window.YTD.follower.part0 = ','',file_get_contents(__DIR__.'/followers.js')),true);
echo "\n\n";
echo number_format(count($followers)).' followers';
echo "\n\n";
levelsio / log_js_errors.js
Created Dec 15, 2019
Log JS errors as a POST to your server
View log_js_errors.js
// <log errors to server>
window.onerror = function (messageOrEvent, source, lineno, colno, error) {
try {
//error message(string).Available as event (sic!) in HTML onerror = "" handler.
messageOrEvent: messageOrEvent,
//URL of the script where the error was raised(string)
source: source,
//Line number where error was raised(number)
View dating_cards_drag_swipe_logic.js
/* dragging logic for */
/* by @levelsio */
/* MIT license */
/* <dragging logic> */
$('body').on('mousedown touchstart','.card',function(e) {
if(!currentCardUserId) return;
if($('card.match_card').is(':visible')) return;
if(typeof e.originalEvent.touches !=='undefined') {
/* touch device */
View Nomad List generate slug function.js
function updateSlug() {
$('.filters .filter.month').length>0 &&
$('.filters .filter.region').length>0
) {
View canggu.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
levelsio / blunble.php
Last active Mar 26, 2020
Blunble Bot for Twitter
View blunble.php
// BLUNBLE BOT (by @levelsio)
// "Blunble" is Korean internet slang for [BL]ock [UNBL]ock
// If you block and unblock somebody on Twitter, they stop following you.
// It's a polite way of getting rid of trolls without permanently blocking
// because blocking usually results in more anger and more trolling.
levelsio / obfuscate.php
Last active Mar 31, 2020
WordPress plugin to progressively obfuscate text like
View obfuscate.php
1) put this in your functions.php file
2) add this to the post you want to obfuscate, on top
3) [obfuscate]
4) to start obfuscating, add a HTML code or HTML block with <start></start>
levelsio / ip_limiter.php
Created Apr 24, 2019
MAKE book IP limiter (req'd by @rashidi_life)
View ip_limiter.php
// check if customer hash correct
$query=$customersDb->prepare("SELECT * FROM customers WHERE secret_hash=:secret_hash");
if(!empty($customer) && $customers[0]['secret_hash']==$_GET['hash']) {
View Hoodify Google Maps
# Copy this URL and add it as a bookmark, then open Google Maps, go to a place, and click it to open Hoodmaps at the same location
# by @marckohlbrugge
View twitter_inbox_cleaner.js
// Twitter lets you close your inbox to people you don't follow. The problem
// is that still authorizes ANYONE who sent you a message EVER to continue
// messaging you, even if your privacy settings are changed.
// The only way (I think) to avoid that is to delete every message from a
// person so that Twitter's internal check "did you talk to this person
// before?" results in FALSE. That sucks because maybe you want more privacy
// than before. But it's do-able by deleteing all the message history of each
// conversation.
You can’t perform that action at this time.