Skip to content

Instantly share code, notes, and snippets.

Avatar

levelsio levelsio

View GitHub Profile
@levelsio
levelsio / git_graph.php
Last active January 30, 2022 08:12
GitHub style graph in PHP + CSS
View git_graph.php
<style>
.git-graph {
text-align: left;
line-height: 1;
}
.git-graph-row {
clear: both;
text-align: left;
}
.git-graph-cell {
View twitterFollowerCuratorBot.php
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
View Better Stripe Invoice Generator by @levelsio
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
View showFirstCellInGoogleSheetAsiOSWidget.js
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
View getRandomFollower.php
<?
$followers=json_decode(file_get_contents(__DIR__.'/followers.json'),true);
echo "\n\n";
echo number_format(count($followers)).' followers';
echo "\n\n";
echo "\n\n";
@levelsio
levelsio / getRandomFollower.php
Created January 11, 2020 10:22
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
levelsio / log_js_errors.js
Created December 15, 2019 15:56
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 {
console.log({
//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 nomadlist.com/dating */
/* 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() {
if(
$('.filters .filter.month .choice.active').length>0 &&
$('.filters .filter.region .choice.active').length>0
) {
slug='';
}
firstTemperatureDoneAlready=false;
@levelsio
levelsio / canggu.geojson
Created August 25, 2019 12:52
canggu.geojson
View canggu.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.