Skip to content

Instantly share code, notes, and snippets.

View richardhedges's full-sized avatar

Richard Hedges richardhedges

View GitHub Profile
@JonnyWong16
JonnyWong16 / sync_playlists_to_users.py
Last active April 20, 2024 12:14
Sync Plex playlists to shared users.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Description: Sync Plex playlists to shared users.
# Author: /u/SwiftPanda16
# Requires: plexapi
from plexapi.exceptions import NotFound
from plexapi.server import PlexServer
@spyesx
spyesx / string-to-slug.js
Last active March 15, 2024 12:05
String to slug in JS (wordpress sanitize_title)
var string_to_slug = function (str)
{
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/_,:;";
var to = "aaaaeeeeiiiioooouuuuncescrzyuudtn------";
for (var i=0, l=from.length ; i<l ; i++)
@ibourgeois
ibourgeois / laravel-routes.php
Last active August 2, 2021 06:55
Bridging Laravel 5 and Lumen with Guzzle
<?php
// Obviously, you would build up the request somewhere other than a route...
Route::get('/api', function()
{
$client = new \GuzzleHttp\Client();
$response = $client->get('http://path/to/api');