BithTree

u/BithTree


r/learnprogramming•

I'm considering using PokeApi for a play project, but I've hit a roadblock early on using resources from this API. When querying for the details of the first pokemon, with a url of https://pokeapi.co/api/v2/pokemon/1, something like below is what is received in the response body.

{

"abilities": [

{

"ability": {

"name": "chlorophyll",

"url": "https://pokeapi.co/api/v2/ability/34/"

},

},

{

"ability": {

"name": "overgrow",

"url": "https://pokeapi.co/api/v2/ability/65/"

},

}

],

"forms": [

{

14

r/learnprogramming•

I've considered taking a crack at this seemingly complex algorithm that determines classes in a video game. Depending on four numbers that range from 0 to (let's say) 7, a different classes is selected. But each class can be further improved. In other words, each particular combination results in a class, and more specific combinations lead to upgraded or even unique classes.

For example, a character has nothing and is a default class. If he gains 2 earth, the class grows into an upgraded default class. But the character decides to have 0 earth, 0 fire, 4 wind, and 4 water, which puts him in another class. Then he gains 1 more wind and wa

11

r/linuxquestions•

I'm thinking about my next desktop and would like to be a bit less constrained. I'd like a wireless setup that streams the display video over the wired network. I don't want to stream over the internet; I want to stream over the wired network specifically. I'd like to use it for gaming, coding (mostly vim from the couch), and web browsing. I'd like to have a few monitors, including the tv, around the house that I can connect to on a whim. I know SteamLink can do this, but I want to do everything this way. Basically, I want the benefits of a laptop with the power of a desktop. I only intend to use it around the house.

Has anyone accomplished this kind of set-up?

14

r/node•

I'm trying to create a socket.io server using nestjs. I want to declare a count and loop incrementally to send count + 1. I want it to loop so that the client just receives the next payload without requesting it. In other words, the client connects, listens to 'tick', then console logs out 0, 1, 2, 3, etc. Each number is pushed by the server to the client.

What is the best way to go about this? I'm thinking of setInterval and async generators because most of my code (game of life simulator) is async. The count is just a simple test to get the looping going for the real code. I'm struggling getting the simple test to work. Any tips or links about using loops with websockets?

22

r/learnprogramming•

How do you personally KISS and YAGNI with your personal projects? I'm a newbie that's "comfortable" with code now, but my architecture eventually becomes a mess. Scrapping it over and over isn't doing me any good. How do you avoid this?

12

r/vim•

Fixed title: Taking notes inside vim for vim-specific stuff so I can remember how to do stuff

I'd like to take notes inside of vim to remember commands and keymappings. I currently use help and a file in my .vim, but it's somewhat burdensome. For example, I only use a couple of fold methods. I don't want to search the help file for it when I can just write a quick note. The note should be callable in vim, so I could do something like :Notes or :Notes fold-all.

Does this exist? I'm not sure what to search. I suppose I could grep the notes file.

126

r/webdev•

I am using Prisma GraphQL as an ORM for a nestjs/express GraphQL API. I like Prisma's queries and mutations, so I want to use those in my front-end (until i eventually wrap them). The issue is that I need two graphql clients in the front-end: one for prisma's built-in CRUD resolvers (port 4466) and one for nestjs/express custom resolvers (port 8000).

Is there a way to forward calls from one port to another? I'd like to have one client (port 8000) that checks if a query/mutation exists in custom resolvers. If so, use that query/mutation. If not, then the nestjs/express app (8000) forwards the request to the prisma server (4466) and returns the forwarded response from the prisma server.

Ngin

10

r/reactjs•

I'm looking for a component library that gives a bit more than material-ui but doesn't require react-admin's time-consuming customization of data providers. Ideally, I'd like something that can mostly put together a detail view and list view for RESTful resources.

I don't mind specifying properties to display, fetching the data myself, and handling all of the store logic, but I'd like to avoid having to handle all of the design myself (even using MUI). It doesn't have to be material design, but I prefer it as I've used it before.

I enjoy putting together the api vs designing, so this is the most time-consuming part for me. I'd like to hear what you use to save time.

81


r/reactjs•

I'm learning redux-saga for my personal project. I'm having trouble figuring out how to run functions outside of a saga after the saga completes. I've read through the docs and various articles, but don't quite have a complete grasp on this. Many resources seem to focus primarily on the sagas themselves but not as much how to communicate with them. I've seen some solutions use promises returned from action creators or including actions in the meta property. I tried the latter, but redux endlessly complains about serializability even though I'm not storing functions into the store. How do you do it?

Particularly, I want to dynamically redirect after a resource creation form (using formik) su

46

r/typescript•

I'm enjoying typescript but having an issue understanding generics in some of d.ts files I'm using. I've noticed many use one letter to represent a type. When I write types, I use full one-or-two-word Pascal case as names and it works just fine. I was trying to interpret redux-thunk so redux's dispatch would play well, but the types are unclear to me. I feel like the concept of appropriate variable naming would apply here.

I imagine there's a reason to the madness. But what is it?

1134


r/vim•

See resolution as the bottom

I'm trying to get vim, ale, eslint, and flow to all work together, but I'm stuck on this one issue. When I declare and use a flow type, such as Props, ale indicates two errors:

  • 8008: 'type aliases' can only be used in a .ts file

  • 8010: 'types' can only be used in a .ts file

I don't have anything related to typescript in this project and have even told ale to ignore the tsserver (which I don't have) in my vimrc. Additionally, ale tells me that flow is not a valid fixer despite being in the list of available fixers via :ALEInfo. What did you need to get these ale, eslint, and

411

r/node•

I have a Course, Student, and Roster tables. Course and Student are data tables. The Roster table is a join table with CourseId and StudentId via belongsToMany from Course and Student. I want to create another table that tracks attendance. I imagine that this AttendanceLog table will have a RosterId fk and some other fields.

How would you tackle this in terms of database schema and associations? I'm using sequelize migrations, so I would declare it all there first. I can create the join tables, but not much else besides getStudents and setStudents.

My current idea is to take a CourseId and StudentId in the req body, derive the Roster's pk through a method on Roster, then query with that pk

46

r/django•

Djoser's docs mention the use of the latter framework as a requirement for JWT support. However, that framework hasn't been updated since Oct 5th, 2017, doesn't mention support for Django 2.0, and doesn't seem to be maintained anymore. Is Djoser compatible with django_rest_framework_simplejwt? Or should I plan my project around the continued use of rest_framework_jwt?

02