Skip to content

Instantly share code, notes, and snippets.

View JacobMJones's full-sized avatar

Jacob Jones JacobMJones

View GitHub Profile
use mini_redis::Command::{self, Get, Set};
use mini_redis::{Connection, Frame};
use std::collections::HashMap;
use std::sync::Arc;
use tokio::net::{TcpListener, TcpStream};
#[derive(Debug)]
struct PlayerData {
client_ip: String,
client_position_x: f32,
@JacobMJones
JacobMJones / gist:5cfe20ae3a916f2e1f4deda32738444e
Created December 21, 2023 03:28
rust server updated commented
//TcpListener: A TCP socket server, listening for connections from TCP clients.
//TcpStream: Represents a TCP connection to a remote server, used for sending and receiving data.
use tokio::net::{TcpListener, TcpStream};
//Connection: Manages a connection to a mini-Redis server, handling the sending and receiving of data frames.
//Frame: Represents a frame in the Redis protocol, which is a basic unit of communication in Redis, containing commands or data.
use mini_redis::{Connection, Frame};
@JacobMJones
JacobMJones / gist:bdb2161adcbc4b8349af3f8c86511ec4
Created November 15, 2023 22:40
A star path finding explanation in python
# The total cost of a node is calculated as
# f(n) = g(n) + h(n)
# g(n) is the cost from the start node to the current node, and
# h(n) is the estimated cost from the current node to the goal.
# f value is the sum of g and h and is used to compare nodes when deciding
# the parent attribute of a Node
@JacobMJones
JacobMJones / FindAmountOfTimesAValueOccurs
Created August 4, 2019 01:54
Finds the amount of times a value occurs in an array of objects
calculate() {
const programs = [];
const arrayOfNames = [
...new Set(this.props.accounts.map(item => item.Program))
].map(item => {
programs.push({ program: item, amount: 0 });
});
this.props.accounts.map(item => {
const index = programs.map(e => e.program).indexOf(item.Program);
@JacobMJones
JacobMJones / with click developed marble
Created March 3, 2019 04:43
with click developed marble
import * as THREE from "three";
import alphaTexture from "./Images/clean-grey-gradient.jpg";
import { Vector3 } from "three";
export default scene => {
var raycaster = new THREE.Raycaster();
var lastMouse;
const group = new THREE.Group();
var speed = .1;
const subjectGeometry = deformGeometry(new THREE.IcosahedronGeometry(14, 4));
Lights:
import * as THREE from 'three'
export default scene => {
// const lightIn = new THREE.PointLight("blue", 30);
const lightOut = new THREE.DirectionalLight("fff", 1);
lightOut.position.set(40,20,400);
//scene.add(lightIn);
@JacobMJones
JacobMJones / sleek geometry marble
Created March 2, 2019 17:02
Sleek geometry marble
import * as THREE from 'three'
import alphaTexture from './clean-grey-gradient.jpg';
export default scene => {
const group = new THREE.Group();
const subjectGeometry = deformGeometry(new THREE.IcosahedronGeometry(7, 5));
@JacobMJones
JacobMJones / Psych Marble 2 x+y rotation simpler
Created March 2, 2019 16:45
Psych Marble 2 x+y rotation simpler
import * as THREE from 'three'
import alphaTexture from './stripe6.jpg';
export default scene => {
const group = new THREE.Group();
const subjectGeometry = deformGeometry(new THREE.IcosahedronGeometry(7, 5));
const subjectMaterial = new THREE.MeshStandardMaterial({ color: "red", transparent: true, side: THREE.DoubleSide, alphaTest: 0.1 });
subjectMaterial.alphaMap = new THREE.TextureLoader().load(alphaTexture);
@JacobMJones
JacobMJones / 3js Psychedelic rotating marble
Last active November 3, 2021 16:20
3js Psychedelic rotating marble
//For three.js, based off of https://github.com/PierfrancescoSoffritti/pierfrancescosoffritti.com/blob/master/src/components/home/header/threejs/SceneSubject.js
import * as THREE from 'three'
import alphaTexture from './stripe6.jpg';
export default scene => {
const group = new THREE.Group();
const subjectGeometry = deformGeometry(new THREE.IcosahedronGeometry(7, 5));
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>