Skip to content

Instantly share code, notes, and snippets.

View beautyfree's full-sized avatar
😼

Alexey Elizarov beautyfree

😼
View GitHub Profile
@du5rte
du5rte / autoStore.js
Last active August 30, 2024 18:08
Auto saving to localStorage with MobX
import mobx from "mobx"
import store from "store"
export default function(_this) {
let firstRun = true
// will run on change
mobx.autorun(() => {
// on load check if there's an existing store on localStorage and extend the store
if (firstRun) {
@ayamflow
ayamflow / gist:96a1f554c3f88eef2f9d0024fc42940f
Last active April 3, 2025 22:26
Threejs Fit plane to screen
var cameraZ = camera.position.z;
var planeZ = 5;
var distance = cameraZ - planeZ;
var aspect = viewWidth / viewHeight;
var vFov = camera.fov * Math.PI / 180;
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance;
var planeWidthAtDistance = planeHeightAtDistance * aspect;
// or
@learner-long-life
learner-long-life / Rinkeby.md
Last active August 30, 2022 22:32
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@pschmitt
pschmitt / proxmox-get-vm-ip.sh
Created July 15, 2017 17:53
Get the IP address of a VM hosted on Proxmox
#!/usr/bin/env bash
usage() {
echo "$(basename $0) VM"
}
get_vm_id() {
qm list | awk '/'"${1}"'/ { print $1 }'
}
package main
import (
"fmt"
"os"
"errors"
"path/filepath"
"context"
"bytes"
chain: ropsten
# Use automated Chrome to verify all contracts on etherscan.io
# You need to install Splinter package:
# pip install splinter
verify_on_etherscan: no
browser_driver: chrome
contracts:
@veltman
veltman / README.md
Created September 2, 2017 12:00
Canvas animation to video
@cezarneaga
cezarneaga / filterArraysRamda.md
Last active April 26, 2023 07:52
Filter array of objects by nested values using ramda: Sometimes you dont have access to backend and you want to filter the response from an endpoint based on certain criteria. While trivial on flat arrays, this gets a bit tricky if the property you want to query is deeply nested. This is where Ramda shines.

Say we have a prop.users of the shape:

const users = [
    {username: 'bob', age: 30, tags: [{name: 'work', id: 1}, {name: 'boring', id: 2}]},
    {username: 'jim', age: 25, tags: [{name: 'home', id: 3}, {name: 'fun', id: 4}]},
    {username: 'jane', age: 30, tags: [{name: 'vacation', id: 5}, {name: 'fun', id: 4}]}
];
@XanderLuciano
XanderLuciano / BetterOrbitControls.js
Created February 16, 2018 14:25
Improved three.js orbit controls with improved support for mobile devices, improved smoothing, and a few other features. Will have to merge in additional changes (like setAzimuthalAngle, setPolarAngle, and setRotation).
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
*/
// This set of controls performs orbiting, dollying (zooming), and panning.
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
@reflog
reflog / conf.js
Created May 7, 2018 08:28
next js with typescript via babel
{
"presets": ["@babel/preset-typescript", "next/babel"],
}
/* tslint:disable */
const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withTypescript = require("@zeit/next-typescript");
const withSourceMaps = require("@zeit/next-source-maps");