Skip to content

Instantly share code, notes, and snippets.

View Uvacoder's full-sized avatar

uvacoder Uvacoder

View GitHub Profile
@Uvacoder
Uvacoder / userstyle-for-new-tweetdeck.css
Created June 21, 2024 18:46 — forked from insin/userstyle-for-new-tweetdeck.css
Userstyle for New TweetDeck - use with the Stylus extension: https://github.com/openstyles/stylus#stylus
/* Hide... */
/* Views on list tweets */
[data-testid="tweet"][tabindex="0"] div[id^=id__][role=group] > div:nth-child(4):nth-last-child(2),
/* Views on focused tweet */
[data-testid="tweet"][tabindex="-1"] div[dir] + div[aria-hidden="true"]:nth-child(2):nth-last-child(2),
[data-testid="tweet"][tabindex="-1"] div[dir] + div[aria-hidden="true"]:nth-child(2):nth-last-child(2) + div[dir]:last-child,
/* Bookmark button on focused tweet */
[data-testid="tweet"][tabindex="-1"] div[id^=id__][role=group] > div:nth-child(4):nth-last-child(2),
/* Share button on all tweets */
div[id^=id__][role=group] > div:nth-child(5):last-child,
@Uvacoder
Uvacoder / console.js
Created June 21, 2024 18:46 — forked from insin/console.js
Get currently-loaded user entities on twitter.com
entities = $('#react-root')._reactRootContainer._internalRoot?.current?.memoizedState?.element?.props?.children?.props?.store?.getState()?.entities?.users?.entities
users = {}
for (let user of Object.values(entities)) {
users[user.screen_name] = user
}
@Uvacoder
Uvacoder / hide-youtube-shorts.css
Created June 21, 2024 18:45 — forked from insin/hide-youtube-shorts.css
Hide YouTube Shorts - use with the Stylus extension: https://github.com/openstyles/stylus#stylus
/* Nav item */
a[title="Shorts"],
/* Video shelf in Home and Subscriptions */
ytd-rich-shelf-renderer[is-shorts],
/* Video shelf in Search */
ytd-reel-shelf-renderer {
display: none !important;
}
@supports selector(:has(*)) {
let $segments = document.querySelector('.ytd-transcript-search-panel-renderer #segments-container')
let sections = []
let parts = []
for (let $el of $segments.children) {
if ($el.tagName == 'YTD-TRANSCRIPT-SECTION-HEADER-RENDERER') {
if (parts.length > 0) {
sections.push(parts.join(' '))
parts = []
}
@Uvacoder
Uvacoder / updatePasswords.js
Created June 21, 2024 18:43 — forked from insin/updatePasswords.js
Mass update Firefox passwords (run in Tools → Web Developer → Browser Console) - https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox#Enabling_the_Browser_Toolbox
function updatePasswords() {
let oldPassword = prompt('Old password:')
if (!oldPassword) return
let loginManager = Components.classes['@mozilla.org/login-manager;1']
.getService(Components.interfaces.nsILoginManager)
let matchingLogins = loginManager.getAllLogins().filter(l => l.password === oldPassword)
let matchCount = matchingLogins.length
if (matchCount === 0) return alert('No matching logins found')
@Uvacoder
Uvacoder / currently-playing-spotify-web-api.markdown
Created June 17, 2024 00:49
Currently Playing Spotify Web API
import { useEffect } from 'react'
import { useRouter } from 'next/router'
// Current URL is '/'
function Page() {
const router = useRouter()
useEffect(() => {
// Always do navigations after the first render
router.push('/?counter=10', undefined, { shallow: true, scroll: false })
@Uvacoder
Uvacoder / Spotify.ts
Created June 17, 2024 00:45 — forked from jordantwells42/Spotify.ts
using Spotify Next Auth
const client_id = process.env.SPOTIFY_CLIENT_ID
const client_secret = process.env.SPOTIFY_CLIENT_SECRET
const authorization_code = Buffer.from(`${client_id}:${client_secret}`).toString('base64')
const getAccessToken = async (refresh_token: string) => {
const response = await fetch(`https://accounts.spotify.com/api/token`, {
method: 'POST',
headers: {
Authorization: authorization_code,
'Content-Type': 'application/x-www-form-urlencoded'
export const refreshTokens = async () => {
try {
const credentials = await getSpotifyCredentials() //we wrote this function above
const credsB64 = btoa(`${credentials.clientId}:${credentials.clientSecret}`);
const refreshToken = await getUserData('refreshToken');
const response = await fetch('https://accounts.spotify.com/api/token', {
method: 'POST',
headers: {
Authorization: `Basic ${credsB64}`,
'Content-Type': 'application/x-www-form-urlencoded',
@Uvacoder
Uvacoder / spotify-currently-playing.js
Created June 16, 2024 22:41 — forked from rohitjethoe/spotify-currently-playing.js
funny embedding for personal websites
/*
* Spotify Currently Playing
* 28/03/2023
**/
const clientId = "CLIENT_ID",
clientSecret = "CLIENT_SECRET",
refresh_token = "REFRESH_TOKEN",
TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token";