Skip to content

Instantly share code, notes, and snippets.

View insin's full-sized avatar
⚠️
Cannot read property 'status' of undefined

Jonny Buchanan insin

⚠️
Cannot read property 'status' of undefined
View GitHub Profile
@insin
insin / YouYubeEmbed.astro
Created May 11, 2023 09:25
Lightweight YouTube embed component for Astro
---
export interface Props {
title: string
videoCode: string
}
let {title, videoCode} = Astro.props
let playButtonSvg = `<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg>`
let srcdoc = `<style>*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img{position:absolute;width:100%;top:0;bottom:0;margin:auto}.button{position:absolute;left:50%;top:50%;width:68px;height:48px;margin-left:-34px;margin-top:-24px;}.top{position:absolute;top:18px;left:18px;right:18px;display:flex;flex-wrap:nowrap}.title{color:#fff;font-size:18px;white-space:nowrap;word-wrap:normal;text-shadow:0 0 2px rgba(0,0,0,.5);font-fam
@insin
insin / README.md
Last active February 26, 2024 12:31
stargaze - watch a GitHub repo's star count, with change notifications

Stargaze

Watch a GitHub repo's star count, with change notifications.

Usage

Download and extract the Gist (over there somewhere →).

Install dependencies:

@insin
insin / README.md
Last active February 13, 2024 21:59
Extract Minecraft music

Extract Minecraft music

As of 1.8, assets are stored by hash, which makes it fiddly to listen to Minecraft's amazing ambient soundtrack outside the game.

This script can be used to copy music files to appopriately-named and organised .ogg files for easier listening.

1. Install Node.js or io.js

2. Save extract-music.js to your Minecraft assets directory:

@insin
insin / index.html
Last active February 8, 2024 15:14
Export a <table> to Excel - http://bl.ocks.org/insin/1031969
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>
@insin
insin / contactform.js
Last active January 9, 2024 05:27
React contact form example
/** @jsx React.DOM */
var STATES = [
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI',
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS',
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR',
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'
]
var Example = React.createClass({
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 = []
}
@insin
insin / hide-youtube-shorts.css
Last active December 26, 2023 02:22
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(*)) {
@insin
insin / bash_prompt.sh
Created December 3, 2011 01:49 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@insin
insin / wiiclassic-mayflash.cfg
Created April 29, 2016 17:20
MAME controller configuration for Wii Clasic Controller/Classic Controller Pro using the Mayflash USB adapter
<mameconfig version="10">
<system name="default">
<!--
Wii Classic Controller/Classic Controller Pro with Mayflash USB adapter
BUTTON1: X
BUTTON2: A
BUTTON3: B
BUTTON4: Y
BUTTON5: ZL
@insin
insin / updatePasswords.js
Last active October 11, 2023 07:33
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')