Skip to content

Instantly share code, notes, and snippets.

View programandoconro's full-sized avatar
💭
Programming is art, science and tech

Ro programandoconro

💭
Programming is art, science and tech
View GitHub Profile
@andreyryabtsev
andreyryabtsev / backmatting.ipynb
Last active June 5, 2024 04:56
BackMatting.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@silas
silas / README.md
Created June 20, 2019 15:15
Anki JavaScript Cards

Anki JavaScript Cards

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

Instructions

@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 2, 2025 03:01
useLayoutEffect and server rendering

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.

Option 1: Convert to useEffect

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() {
@konojunya
konojunya / main.go
Last active November 21, 2022 09:54
Sample using gin's BindJSON
package main
import (
"fmt"
"log"
"github.com/gin-gonic/gin"
)
type CreateParams struct {
@jferrao
jferrao / haversine.kt
Last active October 8, 2025 07:35
Kotlin implementation of the Haversine formula
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".
@takahirom
takahirom / EventBus.kt
Last active June 8, 2024 14:09
EventBus by Kotlin coroutine
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
@veggiefrog
veggiefrog / .vimrc
Created November 19, 2017 20:09
VIM: Remember last position in file
" Remember position of last edit and return on reopen
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
@ywwwtseng
ywwwtseng / host-react-app-on-apache-server.md
Last active August 5, 2025 18:26
Host react application on Apache server

Host react application on Apache server

Step 1 : Create your app

$ npm install -g create-react-app 
$ create-react-app my-app

Step 2 : Build it for production

@ccooper21
ccooper21 / mqtt_websocket_example.py
Created October 16, 2017 00:17
Example MicroPython MQTT over WebSocket script
# 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
@simoncos
simoncos / golang_on_rpi.md
Last active March 7, 2025 06:21 — forked from konradko/golang_on_rpi.md
Install Golang 1.9 on Raspberry Pi

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: