This demonstrates one method for creating JavaScript based Anki cards.
Tested on
- [Anki for desktop computers][anki-desktop] version 2.1.13
- [AnkiMobile][anki-mobile] (iOS) version 2.0.48
If you use server rendering, keep in mind that neither useLayoutEffect
nor useEffect
can run until the JavaScript is downloaded.
You might see a warning if you try to useLayoutEffect
on the server. Here's two common ways to fix it.
If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect
instead.
function MyComponent() {
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/gin-gonic/gin" | |
) | |
type CreateParams struct { |
class Geo(private val lat: Double, private val lon: Double) { | |
companion object { | |
const val earthRadiusKm: Double = 6372.8 | |
} | |
/** | |
* Haversine formula. Giving great-circle distances between two points on a sphere from their longitudes and latitudes. | |
* It is a special case of a more general formula in spherical trigonometry, the law of haversines, relating the | |
* sides and angles of spherical "triangles". |
import kotlinx.coroutines.experimental.channels.BroadcastChannel | |
import kotlinx.coroutines.experimental.channels.ConflatedBroadcastChannel | |
import kotlinx.coroutines.experimental.channels.ReceiveChannel | |
import kotlinx.coroutines.experimental.channels.filter | |
import kotlinx.coroutines.experimental.channels.map | |
import kotlinx.coroutines.experimental.launch | |
import javax.inject.Inject | |
import javax.inject.Singleton |
" Remember position of last edit and return on reopen | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
endif |
# This example script requires the MicroPython changes in the following branches: | |
# | |
# https://github.com/ccooper21/micropython/tree/websocket-client-support | |
# https://github.com/ccooper21/micropython-lib/tree/umqtt.simple-websocket-support | |
import usocket as socket | |
import utime as time | |
from websocket import websocket | |
from umqtt.simple import MQTTClient |
Install Golang 1.9:
wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile
If already installed old golang with apt-get: