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 / Select.js
Created July 8, 2015 00:43
React <select> wrapper to make keyboard selection fire onChange in Firefox
/**
* Wraps a <select> to fire onChange in Firefox when the keyboard is used to
* change the selection.
*/
var Select = React.createClass({
propTypes: {
onChange: React.PropTypes.func.isRequired
},
// <select> doesn't have its selection updated yet when onKeyDown fires
handleKeyDown(e) {
require('array.prototype.fill')
var React = require('react')
var EmailList = require('./EmailList')
var App = React.createClass({
render() {
return <div className="App">
<EmailList quantity={5}/>
</div>
@insin
insin / IDEAS.md
Last active May 30, 2023 19:55
IDEAS.md (coming soon - open in http://insin.github.io/ideas-md#98eed17905bcb6a65bf0 for editing)

Hello from Gist!

Hello from IDEAS.md

ideas-md

Markdown ↔ HTML view

Confirmation for certain actions

@insin
insin / react-lessons.json
Created June 26, 2015 14:43
React Lessons Gist Test
{
"name": "Gist Test",
"steps": [
{
"text": "Testing loading a tutorial from a Gist.",
"code": "React.render(<h1>Hello from Gist!</h1>, output)",
"solution": ""
}
]
}
@insin
insin / index.html
Last active August 29, 2015 14:23
react-codemirror: onChange fires when value is set programmatically - http://bl.ocks.org/insin/raw/9e507894f3858028c7e5/
<meta charset="UTF-8">
<script src="https://fb.me/react-0.13.3.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="https://rawgit.com/JedWatson/react-codemirror/master/dist/react-codemirror.js"></script>
<link rel="stylesheet" href="https://rawgit.com/codemirror/CodeMirror/master/lib/codemirror.css">
<div id="app"></div>
<script type="text/jsx;harmony=true">void function() { "use strict";
var valueSeed = 1
@insin
insin / index.js
Created June 19, 2015 12:52
Hide Github comments from people who aren't owners/collaborators
[].forEach.call(document.querySelectorAll('.timeline-comment-wrapper'), comment => {
if (!comment.querySelector('.timeline-comment-label')) {
comment.style.display = 'none'
}
})
@insin
insin / index.js
Created June 15, 2015 11:50
Get the 1-based index of an Excel cell given its column name
var baseCharCode = 'A'.charCodeAt(0) - 1 // Index is 1-based in Excel Interop
function excelColIndex(colName) {
var index = 0
for (var i = 0, pow = colName.length - 1; i < colName.length; i++, pow--) {
index += Math.pow(26, pow) * (colName.charCodeAt(i) - baseCharCode)
}
return index
}
<meta charset="UTF-8">
<title>Did vs. Didn't</title>
<script src="https://fb.me/react-0.13.3.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
<style>
body {
font-family: ubuntu, sans-serif;
}
.App__things {
display: flex;
@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 May 7, 2025 07:44
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: