Skip to content

Instantly share code, notes, and snippets.

@ntasos
ntasos / kdialog-open-files.lua
Last active July 25, 2024 16:21
KDialog-open-files, a lua script for mpv media player that uses KDE KDialog to open files, subtitles or URLs.
-- This is free and unencumbered software released into the public domain.
-- The software is provided "as is", without warranty of any kind.
-- Anyone is free to copy, modify, publish, use, compile, sell, or
-- distribute this software, either in source code form or as a compiled
-- binary, for any purpose, commercial or non-commercial, and by any means.
-- For more information, please refer to <http://unlicense.org/>
--
-- Use KDE KDialog to add files to playlist, subtitles to playing video or open URLs.
-- Based on 'mpv-open-file-dialog' <https://github.com/rossy/mpv-open-file-dialog>.
--
@hensm
hensm / comment_collapser.user.js
Last active April 13, 2022 10:15
Comment Collapser
// jshint esnext: true
// ==UserScript==
// @name Reddit Comment Collapser
// @namespace https://matt.tf
// @author Matt Hensman <m@matt.tf>
// @include /^https?:\/\/(?:www|old|ssl|pay|[a-z]{2})\.reddit\.com\/(?:r\/(?:\w{2,21}|reddit\.com)\/)?comments\/.*$/
// @version 1.6.1
// @updateURL https://gist.github.com/hensm/1b973803f1f4efc238a82d3b26c4ea69/raw/comment_collapser.user.js
// @downloadURL https://gist.github.com/hensm/1b973803f1f4efc238a82d3b26c4ea69/raw/comment_collapser.user.js
@cosmocatalano
cosmocatalano / instagram_scrape.php
Last active August 6, 2023 07:32
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@lakenen
lakenen / detectanimation.js
Created June 28, 2012 17:17
JavaScript animated GIF detection!
function isAnimatedGif(src, cb) {
var request = new XMLHttpRequest();
request.open('GET', src, true);
request.responseType = 'arraybuffer';
request.addEventListener('load', function () {
var arr = new Uint8Array(request.response),
i, len, length = arr.length, frames = 0;
// make sure it's a gif (GIF8)
if (arr[0] !== 0x47 || arr[1] !== 0x49 ||
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//