Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
/** | |
* Uses react-markdown w/ rehype-external-links to demo how to parse markdown | |
* so that the links open in a new tab as external links in your react application. | |
* React-markdown use to have a property that would allow you | |
* to require all links be opened in a new tab but they deprecated it and moved | |
* to a more pluggable architecture using rehype and remark. The plugin required | |
* for react-markdown is rehype-external-links but the documentation doesn't | |
* explain how to use it with react-markdown. Thus here is an example: | |
* | |
* you can find it here https://www.npmjs.com/package/react-markdown - |
let map = new Map(); | |
map.set("a", 1); | |
map.set("b", 2); | |
map.set("c", 3); | |
let obj = [...map.entries()] // or Array.from(map) - either works; | |
.reduce((acc, [key, value]) => | |
({ ...acc, [key]: value }), // Can also spread in reduce or assign, latter is quicker but I love spread syntax lol | |
{} | |
); |
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
Minecraft mods, especially mods which change the client, are by and large written with Forge. If you visit their website, you'll be greeted abruptly by a mysterious message at the top of an SMF forum, with no clear path towards actually... making a mod. I'm documenting here the steps I went through to get started, in the hopes of helping the next person have an easier time of it.
I'll be using Scala for this guide, but it should be fairly easy to adapt these instructions to any JVM language (e.g. clojure or if you're feeling masochistic, Java). I'm also developing on OS X, so some of the commands will be a little different if you're on Linux or Windows. I'm assuming you have some proficiency with your operating system, so I won't go into details about how to adapt those commands to your system.
Minecraft doesn't have an official mod API (despite early [promises](http://notch.t
/** | |
* You can copy and paste this into your browser console and it works as of 1/1/2021 - its not pretty. | |
*/ | |
// replace "user-id" with your actual user id e.g. "123455" & same for auth url | |
const userId = 'my-user-id-goes-here'; | |
const authUrl = 'auth-url-goes-here'; | |
// first gather up all the DOM nodes in the list that have anchors w/ the title id to delete | |
const nodes = document.querySelectorAll('.rowList .title > a'); |
// The polling function | |
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
var checkCondition = function(resolve, reject) { | |
var ajax = fn(); | |
// dive into the ajax promise | |
ajax.then( function(response){ | |
// If the condition is met, we're done! |
[12:03 AM] acemarke: "controlled" and "uncontrolled" inputs
[12:04 AM] acemarke: if I have a plain, normal HTML page, and I put <input id="myTextbox" type="text" />
in my page(edited)
[12:04 AM] acemarke: and I start typing into that textbox
[12:04 AM] acemarke: it remembers what I've typed. The browser stores the current value for that input
[12:05 AM] acemarke: and then sometime later, I can get the actual element, say, const input = document.getElementById("myTextbox")
, and I can ask it for its value: const currentText = input.value;
[12:05 AM] acemarke: good so far?
[12:08 AM] acemarke: I'll keep going, and let me know if you have questions
[12:08 AM] lozio: ok, actually I'm reading
[12:09 AM] lozio: good
[12:09 AM] acemarke: so, a normal HTML input field effectively stores its own value at all times, and you can get the element and ask for its value
#!/bin/bash | |
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport |
""" | |
This is an extension of the technique first detailed here: | |
http://sedimental.org/remap.html#add_common_keys | |
In short, it calls remap on each container, back to front, using the accumulating | |
previous values as the default for the current iteration. | |
""" |