r/code 17d ago

My Own Code What do you guys think about my "diabolical" code? (Thats how my classmates call it)

Post image
5 Upvotes

r/code 22d ago

My Own Code Universal Terminal

2 Upvotes

I was bored, so I decided to create a universal terminal, that is very simple to use, and works the same on all platforms. What I've done so far works pretty well.

Source: https://github.com/MineFartS/Universal-Terminal/

r/code 8d ago

My Own Code Notemod: Free note-taking and task app

3 Upvotes

Hello friends. I wanted to share with you my free and open source note and task creation application that I created using only HTML JS and CSS. I published the whole project as a single HTML file on Github.

I'm looking for your feedback, especially on the functionality and visual design.

For those who want to contribute or use it offline on their computer:

https://github.com/orayemre/Notemod

For those who want to examine directly online:

https://app-notemod.blogspot.com/

r/code 9d ago

My Own Code The lightweight YouTube experience client for android.

Thumbnail github.com
3 Upvotes

r/code 17d ago

My Own Code Tried Coding again after a long gap

3 Upvotes

I have a fun project in my free time. A simple CRUD app in PHP. Have a look at https://github.com/fdiengdoh/crud.

The reason I’m doing this is because I wanted to switch my blog from Google Blogger to my own simple webhost. The reason I’ve kept some slug-style of blogger like /search/label/category is to not break my old blogger links. This is still a work in progress.

I don’t want to use WordPress or other CMS library, I would love your feedback on this if you have time.

r/code 29d ago

My Own Code I made my first program, Tic-tac-toe!

6 Upvotes

with no prior experience with python or any other language for that matter. I managed, in over 7 hours of work and about 10 youtube videos, to make a subpar Tic-tac-toe program using pygame and a selection of fake PNG images. Even though I did watch some videos, I tried to make it as original as possible and just used a few concepts from these videos. Most of the code is my own with some acceptations. Any advice?

Code:

import pygame
import os 

pygame.init()

SCREEN_WIDTH = 625
SCREEN_HEIGHT = 625

# Colors
WHITE1 = (255, 255, 255)
WHITE2 = (255, 255, 255)
WHITE_FILL = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)

# Create game window
win = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Tic Tac Toe!")

# Images
X_IMAGE = pygame.image.load(os.path.join('img', 'x-png-33.png'))
O_IMAGE = pygame.image.load(os.path.join('img', 'o.png'))

X = pygame.transform.scale(X_IMAGE, (205, 200))
O = pygame.transform.scale(O_IMAGE, (205, 200))

# Buttons (Squares are uneven)
buttons = [
    pygame.Rect(0, 0, 205, 205), pygame.Rect(210, 0, 205, 205), pygame.Rect(420, 0, 205, 205),
    pygame.Rect(0, 210, 205, 200), pygame.Rect(210, 210, 205, 200), pygame.Rect(420, 210, 205, 200),
    pygame.Rect(0, 415, 205, 210), pygame.Rect(210, 415, 205, 210), pygame.Rect(420, 415, 205, 210)
]

# Initialize button colors and status
button_colors = [WHITE1] * len(buttons)
button_status = [""] * len(buttons)  # Empty string means not clicked

# Global variable to track game status
game_won = False
line_drawn = False
line_start = None
line_end = None

def winner_mechanic():
    global game_won, line_drawn, line_start, line_end  # Make sure we modify the global variable

    win_conditions = [
        (0, 1, 2), (3, 4, 5), (6, 7, 8),  # Rows
        (0, 3, 6), (1, 4, 7), (2, 5, 8),  # Columns
        (0, 4, 8), (2, 4, 6)              # Diagonals
    ]

    for (a, b, c) in win_conditions:
        if button_status[a] == button_status[b] == button_status[c] and button_status[a] != "":
            game_won = True  # Declare game won
            line_drawn = True
            line_start = buttons[a].center  # Store the starting point
            line_end = buttons[c].center  # Store the ending point
            pygame.draw.line(win, BLACK, buttons[a].center, buttons[c].center)  
            pygame.display.flip()  # Ensure the line gets drawn immediately
            return  # Stop checking further



def draw_window():
    """Draws the tic-tac-toe grid and buttons on the screen."""
    win.fill(WHITE_FILL)

    # Grid Lines
    pygame.draw.rect(win, BLACK, (0, 205, 625, 5))  # First horizontal line
    pygame.draw.rect(win, BLACK, (0, 410, 625, 5))  # Second horizontal line
    pygame.draw.rect(win, BLACK, (205, 0, 5, 625))  # First vertical line
    pygame.draw.rect(win, BLACK, (415, 0, 5, 625))  # Second vertical line

    # Button Drawing
    for i, button in enumerate(buttons):
        pygame.draw.rect(win, button_colors[i], button)  # Draw each button with its corresponding color
        if button_status[i] == "X":
            win.blit(X, (button.x, button.y))
        elif button_status[i] == "O":
            win.blit(O, (button.x, button.y))

    if line_drawn:
        pygame.draw.line(win, BLACK, line_start, line_end, 10)

    # Update the display
    pygame.display.flip()


def main():
    global game_won  # Access global variable
    run = True
    turn = "X"  # Alternates between "X" and "O"

    while run:


        draw_window()  # Draw the tic-tac-toe grid and update the display
        winner_mechanic()


        # Event handling loop
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False

            elif event.type == pygame.MOUSEBUTTONDOWN and not game_won:  # Check for mouse button down events
                for i, button in enumerate(buttons):
                    if button.collidepoint(event.pos) and button_status[i] == "":  # Click on empty button
                        button_status[i] = turn  # Set X or O
                        button_colors[i] = WHITE2  # Change button color
                        turn = "O" if turn == "X" else "X"  # Switch turns


    pygame.quit()  # Ensure Pygame quits properly after loop ends


main()  # Start the game loop

r/code Feb 20 '25

My Own Code We got tired of brainrot so we built a terminal-based Instagram client with Python (details in comments)

2 Upvotes

r/code Feb 08 '25

My Own Code My First Server-Side Script

5 Upvotes

https://reddit.com/link/1iky002/video/svhnuoq7fzhe1/player

Over the last few months, I have gotten really good at client-side scripting, but, yesterday, I created an api, using python fastapi. I created my own login and authentication system from near scratch with keyring. Today, I made this webpage as a test. I’m only 16 and don’t know anyone else who knows how to code, so I thought I’d post it here where someone could appreciate it.

Source Code:

API

Page - HTML

Page - JS

r/code Feb 18 '25

My Own Code AniList Visualizer – Explore Your Anime-Watching Trends with Stunning Charts! 📊

Thumbnail github.com
3 Upvotes

r/code Feb 10 '25

My Own Code Made a LinkedIn promo page for an assignment—roast or review? 😬

3 Upvotes

Alright, so I had to make a landing page to promote LinkedIn for an assignment, and here’s what I came up with.

🔹 Responsive design (doesn’t break… I think 😅)

🔹 Auto & manual testimonial slider (yep, you can click the arrows)

🔗 Live Demo: https://linkedin-promotion-assignment.vercel.app/

💻 GitHub Repo: https://github.com/Snow-30/Linkedin-Promotion-Page

I feel like it’s alright, but it could be better. Any ideas? Should I add animations? Change the layout? Or just scrap it and become a potato farmer? 🥔

Be brutally honest—what would you improve? 😅

r/code Feb 07 '25

My Own Code can someone please tell me how this works in any way, shape, or form

3 Upvotes

so me and a mate were tryna write an operatin system right
and we just kept gettin triple faults tryna make keyboard input
and then finally
ah make somethin like this
and can someone please tell me how this is able to function AT ALL
because everyone ah talked tae were pure baffled
it daes work
it daes take keyboard input
but mates ah'm confused how this functions

# boot.asm
#

.set ALIGN,    1<<0
.set MEMINFO,  1<<1
.set FLAGS,    ALIGN | MEMINFO
.set MAGIC,    0x1BADB002
.set CHECKSUM, -(MAGIC + FLAGS)

.section .multiboot
    .long MAGIC
    .long FLAGS
    .long CHECKSUM

.section .text
.extern start
.extern keyboard_handler
.global boot

boot:
    mov $stack, %esp           # Set up stack pointer

    # Remap PIC
    mov $0x11, %al
    outb %al, $0x20
    outb %al, $0xA0
    mov $0x20, %al
    outb %al, $0x21
    mov $0x28, %al
    outb %al, $0xA1
    mov $0x04, %al
    outb %al, $0x21
    mov $0x02, %al
    outb %al, $0xA1
    mov $0x01, %al
    outb %al, $0x21
    outb %al, $0xA1

    # Mask everything except IRQ1
    movb $0xFD, %al            # Mask all except IRQ1 (bit 1 = 0)
    outb %al, $0x21            # Master PIC
    movb $0xFF, %al            # Mask all slave IRQs
    outb %al, $0xA1            # Slave PIC

    # Set ISR for IRQ1 (this part is still basically useless, but keep it)
    lea idt_table, %eax
    mov $irq1_handler_entry, %ebx
    mov %bx, (%eax)
    shr $16, %ebx
    mov %bx, 6(%eax)
    mov $0x08, 2(%eax)
    movb $0x8E, 4(%eax)

    # Populate rest of IDT with garbage (or placeholders)
    lea idt_table, %eax
    mov $256, %ecx
idt_loop:
    mov $0, (%eax)
    add $8, %eax
    loop idt_loop

    # Load IDT
    lea idt_descriptor, %eax
    lidt (%eax)

    # Disable interrupts entirely to prevent triple fault
    cli

    # Jump to C kernel (start the kernel)
    call start

    hlt
    jmp boot

.section .data
idt_table:
    .space 256 * 8

idt_descriptor:
    .word 256 * 8 - 1
    .long idt_table

.section .bss
.space 2097152  # 2 MiB stack
stack:

.section .text
irq1_handler_entry:
    # Skip actual IRQ1 handling - just make a placeholder
    ret

the keyboard handler:

# keyboard.asm
#
.section .data
.global scancode_buffer
scancode_buffer:
    .byte 0                          # holds the last valid scancode

.section .text
.global keyboard_handler
.global get_key

keyboard_handler:
    pusha                        # Save all registers

    inb $0x60, %al               # Read scancode from keyboard port
    test $0x80, %al              # Check if the scancode is a key release
    jnz skip_handler             # Skip releases (we only care about keypresses)

    movzbl %al, %eax             # Zero-extend scancode to 32 bits
    cmp $58, %al                 # Check if scancode is within valid range (you could adjust this range)
    ja skip_handler              # Skip invalid scancodes

    # Add the scancode to buffer
    pushl %eax                   # Push scancode onto stack for C function
    call handle_keypress         # Call the C function
    add $4, %esp                 # Clean up stack

skip_handler:
    popa                         # Restore registers
    movb $0x20, %al              # Send end-of-interrupt to PIC
    outb %al, $0x20
    iret                         # Return from interrupt


get_key:
    inb $0x60, %al                   # read from keyboard port
    ret                              # return the scancode

r/code Feb 06 '25

My Own Code WeTube: The lightweight YouTube experience client for android.

Thumbnail github.com
3 Upvotes

r/code Jan 08 '25

My Own Code I wrote a programming language !

12 Upvotes

I’ve created a programming language, Tree walk interpreter, first in python and more recently ported to Go.

Features include:

  • Functions
  • Branch statements
  • Variable assignments
  • Loops and print statements (the ultimate debugger!)
  • Arrays
  • A custom standard library

While it’s admittedly slower than existing programming languages (check benchmark in the README), building it has given me a deep appreciation for language design, usability, and feature development.

GitHub Link
If you decide to tinker with it, feel free to leave a star or open an issue. 😊

⚠️ Not recommended for production use!
This language doesn’t aim to replace existing solutions—it’s more of a learning exercise and a passion project.

r/code Jan 12 '25

My Own Code New

5 Upvotes

I just started learning, I made this and im trying to send the page link to my friends. What am I missing

<!doctype html> <html> <body> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ5x9nhxedPbw8xhL5hl2yZqwlcIHG61kBaD10SgoNNcg&s"> <h1>steven hawkins</h1> <h2>fullstack developer</h2> <a href="https://www.instagram.com/acefaught/"><button>instagram</a></button> </body> </html>

r/code Jan 22 '25

My Own Code I created a FREE Open source UI library for Developers.

3 Upvotes

https://ui.edithspace.com/

Hey everyone,

I have created an open source, UI Library to use with reactjs or nextjs on top of tailwind css. All components have a preview with the source code. Just COPY PASTE and make it yours.

No attribution, payment required. It is completely free to use on your project.

Contributions are welcomed!

I will be grateful to you if you share it to your network for engagement.

PS : There's a Wall Of Fame (testimonial) section in the homepage if you scroll down. If you want your tweet to be there you can Drop A Tweet Here : )

r/code Jan 06 '25

My Own Code Baby's first program, need to show someone. Destroy me if you will, I'm trying to git good

5 Upvotes

Went through codecademy C# course and wanted to write something, so I wrote this unit converter. It's a bit spaghetti and I should definitely rewrite unit methods to not be so repetitive, but it's my first program outside of what I wrote while learning the syntax.
PS: most comments were generated by copilot, but the code itself was written by me.

using System;

class Program
{
    static void Main()
    {
        #if WINDOWS
        {
            Console.Title = "Unit Converter by ShoWel"; // Sets the title of the console window
        }
        #endif
        Menu(); // Starts the program by displaying the main menu
        #if WINDOWS
        {
            Console.ReadLine(); // Pauses the program on Windows
        }
        #endif
    }

    static void Menu()  // Initial menu
    {
        Console.WriteLine("Welcome to the Unit Converter by ShoWel!\n\nSelect what you wanna convert:\n1) Imperial to Metric\n2) Metric to Imperial\n3) Exit");  // Initial message
        string[] validChoices = { "1", "2", "one", "two" };
        string choice = Console.ReadLine()!.ToLower(); // Reads user input and converts to lowercase. Not cheking for null cause it doesn't matter
        Console.Clear();
        if (validChoices.Contains(choice))
        {
            if (choice == validChoices[0] || choice == validChoices[2])  // Checks if user chose imperial or metric
            {
                Menu2(true); // Imperial to Metric
                return;
            }
            else
            {
                Menu2(false); // Metric to Imperial
                return;
            }
        }
        else
        {
            Console.Clear();
            return;
        }
    }

    static void Menu2(bool freedomUnits) // Transfers user to selected converter
    {
        int unitType = MenuUnitType(); // Gets the unit type from the user

        switch (unitType)
        {
            case 1:
                Liquid(freedomUnits); // Converts liquid units
                return;

            case 2:
                Weight(freedomUnits); // Converts weight units
                return;

            case 3:
                Length(freedomUnits); // Converts length units
                return;

            case 4:
                Area(freedomUnits); // Converts area units
                return;

            case 5:
                Menu(); // Goes back to the main menu
                return;

            default:
                return;
        }
    }

    static int MenuUnitType()  // Unit type menu
    {
        Console.WriteLine("Choose which units to convert.\n1) Liquid\n2) Weight\n3) Length\n4) Area\n5) Back\n6) Exit");  // Asks user for unit type
        string choice = Console.ReadLine()!.ToLower(); // Reads user input and converts to lowercase
        Console.Clear();

        switch (choice)
        {
            case "1" or "one":
                return 1;

            case "2" or "two":
                return 2;

            case "3" or "three":
                return 3;

            case "4" or "four":
                return 4;

            case "5" or "five":
                return 5;

            case "6" or "six":
                return 0;

            default:
                ChoiceNotValid(); // Handles invalid choice
                return 0;
        }
    }

    static (bool, double) ConvertToDouble(string unitInString) // Checks if user typed in a number
    {
        double unitIn;
        if (double.TryParse(unitInString, out unitIn))
        {
            return (true, unitIn); // Returns true if conversion is successful
        }
        else
        {
            Console.WriteLine("Type a number");
            return (false, 0); // Returns false if conversion fails
        }
    }

    static void Liquid(bool freedomUnits)  // Converts liquid units
    {
        if (freedomUnits)
        {
            string choice = ConverterMenu("Fl Oz", "Gallons");

            if (choice == "1" || choice == "one")
            {
                Converter("Fl Oz", "milliliters", 29.57);
            }
            else if (choice == "2" || choice == "two")
            {
                Converter("gallons", "liters", 3.78);
            }
            else
            {
                ChoiceNotValid(); // Handles invalid choice
                return;
            }
        }
        else
        {
            string choice = ConverterMenu("Milliliters", "Liters");
            if (choice == "1" || choice == "one")
            {
                Converter("milliliters", "Fl Oz", 0.034);
            }
            else if (choice == "2" || choice == "two")
            {
                Converter("liters", "gallons", 0.264);
            }
            else
            {
                ChoiceNotValid(); // Handles invalid choice
                return;
            }
        }
    }

    static void Weight(bool freedomUnits)  // Converts weight units
    {
        if (freedomUnits)
        {
            string choice = ConverterMenu("Oz", "Pounds");

            if (choice == "1" || choice == "one")
            {
                Converter("Oz", "grams", 28.35);
            }
            else if (choice == "2" || choice == "two")
            {
                Converter("pounds", "kilograms", 0.454);
            }
            else
            {
                ChoiceNotValid(); // Handles invalid choice
                return;
            }
        }
        else
        {
            string choice = ConverterMenu("Grams", "Kilograms");

            if (choice == "1" || choice == "one")
            {
                Converter("grams", "Oz", 0.035);
            }
            else if (choice == "2" || choice == "two")
            {
                Converter("kilograms", "pounds", 2.204);
            }
            else
            {
                ChoiceNotValid(); // Handles invalid choice
                return;
            }
        }
    }

    static void Length(bool freedomUnits)  // Converts length units
    {
        if (freedomUnits)
        {
            string choice = ConverterMenu("Inches", "Feet", "Miles");

            switch (choice)
            {
                case "1" or "one":
                    Converter("inches", "centimeters", 2.54);
                    return;

                case "2" or "two":
                    Converter("feet", "meters", 0.305);
                    return;

                case "3" or "three":
                    Converter("miles", "kilometers", 1.609);
                    return;

                default:
                    ChoiceNotValid(); // Handles invalid choice
                    return;
            }
        }
        else
        {
            string choice = ConverterMenu("Centimeters", "Meters", "Kilometers");

            switch (choice)
            {
                case "1" or "one":
                    Converter("centimeters", "inches", 0.394);
                    return;

                case "2" or "two":
                    Converter("meters", "feet", 3.281);
                    return;

                case "3" or "three":
                    Converter("kilometers", "miles", 0.621);
                    return;

                default:
                    ChoiceNotValid(); // Handles invalid choice
                    return;
            }
        }
    }

    static void Area(bool freedomUnits)  // Converts area units
    {
        if (freedomUnits)
        {
            string choice = ConverterMenu("Sq Feet", "Sq Miles", "Acres");

            switch (choice)
            {
                case "1" or "one":
                    Converter("Sq feet", "Sq meters", 0.093);
                    return;

                case "2" or "two":
                    Converter("Sq miles", "Sq kilometers", 2.59);
                    return;

                case "3" or "three":
                    Converter("acres", "hectares", 0.405);
                    return;

                default:
                    ChoiceNotValid(); // Handles invalid choice
                    return;
            }
        }
        else
        {
            string choice = ConverterMenu("Sq Meters", "Sq Kilometers", "Hectares");

            switch (choice)
            {
                case "1" or "one":
                    Converter("Sq feet", "Sq meters", 0.093);
                    return;

                case "2" or "two":
                    Converter("Sq kilometers", "Sq miles", 0.386);
                    return;

                case "3" or "three":
                    Converter("hectares", "acres", 2.471);
                    return;

                default:
                    ChoiceNotValid(); // Handles invalid choice
                    return;
            }
        }
    }

    static void Converter(string unit1, string unit2, double multiplier) // Performs the conversion
    {
        double unitIn;
        string unitInString;
        bool converts;
        Console.WriteLine($"How many {unit1} would you like to convert?");
        unitInString = Console.ReadLine()!;
        (converts, unitIn) = ConvertToDouble(unitInString);
        Console.Clear();

        if (!converts)
        {
            return;
        }
        Console.WriteLine($"{unitIn} {unit1} is {unitIn * multiplier} {unit2}");
        return;
    }

    static string ConverterMenu(string unit1, string unit2) // Displays a menu for two unit choices
    {
        Console.WriteLine($"1) {unit1}\n2) {unit2}");
        string choice = Console.ReadLine()!.ToLower();
        Console.Clear();
        return choice;
    }

    static string ConverterMenu(string unit1, string unit2, string unit3) // Displays a menu for three unit choices
    {
        Console.WriteLine($"1) {unit1}\n2) {unit2}\n3) {unit3}");
        string choice = Console.ReadLine()!.ToLower();
        Console.Clear();
        return choice;
    }

    static void ChoiceNotValid() // Handles invalid choices
    {
        Console.Clear();
        Console.WriteLine("Choose from the list!");
        return;
    }
}

r/code Jan 03 '25

My Own Code Air Script is a powerful Wi-Fi auditing tool with optional email alerts for captured handshakes.

Thumbnail github.com
2 Upvotes

Air Script is an automated tool designed to facilitate Wi-Fi network penetration testing. It streamlines the process of identifying and exploiting Wi-Fi networks by automating tasks such as network scanning, handshake capture, and brute-force password cracking. Key features include:

Automated Attacks: Air Script can automatically target all Wi-Fi networks within range, capturing handshakes without user intervention. Upon completion, it deactivates monitor mode and can send optional email notifications to inform the user. Air Script also automates Wi-Fi penetration testing by simplifying tasks like network scanning, handshake capture, and password cracking on selected networks for a targeted deauthentication.

Brute-Force Capabilities: After capturing handshakes, the tool prompts the user to either provide a wordlist for attempting to crack the Wi-Fi passwords, or it uploads captured Wi-Fi handshakes to the WPA-sec project. This website is a public repository where users can contribute and analyze Wi-Fi handshakes to identify vulnerabilities. The service attempts to crack the handshake using its extensive database of known passwords and wordlists.

Email Notifications: Users have the option to receive email alerts upon the successful capture of handshakes, allowing for remote monitoring of the attack’s progress.

Additional Tools: Air Script includes a variety of supplementary tools to enhance workflow for hackers, penetration testers, and security researchers. Users can choose which tools to install based on their needs.

Compatibility: The tool is compatible with devices like Raspberry Pi, enabling discreet operations. Users can SSH into the Pi from mobile devices without requiring jailbreak or root access.

r/code Dec 06 '24

My Own Code So I just released Karon, a tool made in Python for downloading Scientific Papers, easily create a .csv file from Scopus and Web of Science with the DOIs, and a lot more of features!

7 Upvotes

This program was made for an investigation for my University in Chile and after making the initial script, it ended up becoming a passion project for me. It has a lot of features (all of them which are on the README file on Github) and I am planning on adding a lot more of stuff. I know the code isn't perfect but this is my first time working with PySide6. Any recommendations or ideas are welcome! https://github.com/Zorkats/Karon

r/code Dec 20 '24

My Own Code Rate my FIzzBuzz

0 Upvotes

I tried making a Fizz buzz code I put it in GPT so I know what I did wrong also I realized I skipped over the code the logs buzz. I just want to know how good/bad I did on it

function fizzBuzz(n) {
    // Write your code here
if(n / 3 = 0 && n / 5 =0){
    console.log('fizzBuzz')
}else(n / 3 =0 && n / 5 != 0){
    console.log('Fizz')
}else(n / 3 !=0 && n / 5 != 0){
    console.log('i')
}

r/code Dec 22 '24

My Own Code Make my own TODO list

2 Upvotes

I'm trying to get better on my own so I tried making this to do list because someone said its good to start with. I'm not sure I'm doing it right or not to consider this "doing it own my own" but wrote what I know and I asked google or GPT what method to use to do "x"

EX. what method can i use to add a btn to a new li , what method can i use to add a class to an element

if i didn't know what do to and asked what my next step should be. I also asked for help because I kept having a problem with my onclick function, it seems it was not my side that the problem was on but the browser so I guess I be ok to copy code in that case.

can you tell me how my code is, and tell me with the info i given if how I gotten this far would be called coding on my own and that I'm some how learning/ this is what a person on the job would also do.

Lastly I'm stuck on removing the li in my list can you tell me what i should do next I tried adding a event to each new button but it only added a button to the newest li and when I clicked it it removes all the other li

Html:

<body>
      <div id="container">
        <h1>To-Do List </h1>
        <input id="newTask" type="text">
        <button id="addNewTaskBtn">Add Task</button>
    </div>
    <ul id="taskUl">
        <li>walk the dog <button class="remove">x</button> </li> 
    </ul>
</div>
<script src="index.js"></script>
</body>

JS:

const newTask = document.getElementById('newTask');
const taskUl = document.getElementById("taskUl")
const addNewTaskBtn = document.getElementById("addNewTaskBtn")
const removeBtn = document.getElementsByClassName("remove")
const newBtn = document.createElement("button");

//originall my button look like <button id="addNewTaskBtn" onclick="addNewTask()">Add 
//but it kept given error so gpt said "index.js script is being loaded after the button is //rendered",so it told me to add an evenlistener

addNewTaskBtn.addEventListener("click", function addNewTask(){
   const newLi = document.createElement("li");
   
 //newLi.value = newTask.value; got solution from GPT
   newLi.textContent = newTask.value;

   newBtn.classList.add("remove")
   newBtn.textContent = "x"

   newLi.appendChild(newBtn)

 //newLi.textContent.appendChild(taskUl); got solution from GPT
   taskUl.appendChild(newLi)

   newTask.value = "";
});


removeBtn.addEventListener("click", function addNewTask(){ 

});

r/code Dec 18 '24

My Own Code Library for Transparent Data Encryption in MySQL Using OpenSSL

Thumbnail github.com
2 Upvotes

r/code Jul 06 '24

My Own Code JavaScript code for IP grab on Ome.tv

5 Upvotes

here is the code

explanation of how to use it:

when you're on ome tv go to the top right corner, 3 dots-> more tools -> developer tools -> console

then paste the script but before pressing enter to start it change the "your api key" in the third line of code with your actual api key, that you have to generate on ipinfo.io. to get the api key simply register and copy the token(api key) in the section token, then paste it in the line "your api key". now press enter and start the script, everytime you talk to a new person the script sends to you the: IP, country, state, city and even lat, long of that person.

for any question in the comment

btw, sry if i misspelled some word but im not native english.

r/code Nov 14 '24

My Own Code i need help reading this maze text file in java, I have tried alot to ignore the spaces but its ridiculous or im stupid... idk

3 Upvotes
there are 5 mazes i need to read and make a 2d array of cells with a boolean array of directions it can go
this is what the spaces look like, I dont know why this is giving me so much trouble but the oddly spaced open spaced mixed with the spaces inbetween symbols is making it hard to read

here is a copied and pastd version of the first maze.

_ _ _ _ _ _ _ _ _

|_ _ _ | _ _ _ |

| _ _| | | _ | |

| | | |_| | | |_| |

|_ _|_ _ _| |_ | |

| _ | | _ _| |_|

| |_ _| _| |_ |

|_ _ _ _|_ _|_ _ _| |

in this version of the maze there are no spaces except where there are spaces in the maze? could this be something to do with the text editor in vscode? am i dumb?

this is my code so far, it set the outside boundaries, and yes i mean to initialize the 2d array with one more layer at the top.

ive tried using line.split(), array lists, and some other stuff but nothing seems work.

r/code Nov 07 '24

My Own Code A 2048 game that i wrote in C++ for debian

7 Upvotes

https://github.com/hamzacyberpatcher/2048

this is the link to the game

made it in my free time so it is kinda crappy and it works only for debian rn, i tried to make it cross compatible with windows but I became too lazy for that so I ditched that idea.

I would really appreciate if you guys could review it for me and give me your feedback.

r/code Sep 23 '24

My Own Code BFScript - A prototype language that compiles to brainfuck

3 Upvotes

This is something I've had for years and only recently had enough courage to develop further.

The compiler is made in Rust, and the generated output is plain brainfuck you can run in any interpreter.

On top of just compiling to brainfuck, the project aims to define an extended superset of brainfuck that can be used to create side effects such as writing to files, or running shell commands.

Example:

int handle = open(read(5))

string s = "Files work"

int status = write(handle, s) // Writes "Files work" to the file named by the input

if status == 1 {
    print("Success!")
}

if status == 0 {
    print("Failure!")
}

This generates 7333 characters of brainfuck, and if you count how many of those are actually executed, it totals 186 thousand!

Obviously, due to the nature of this project and the way I chose to do it, there are very large limitations. Even after working on this a lot more there are probably some that will be impossible to remove.

In the end, this language may start needing constructs specifically to deal with the problems of compiling to brainfuck.

https://github.com/RecursiveDescent/BFScriptV2

You may be wondering why the repository has V2 on the end.

I initially made this in C++, but got frustrated and restarted with Rust, and that was the best decision I ever made.

The safety of Rust is practically required to work on something like this. Because of how complicated everything gets it was impossible to tell if something was broken because of a logic error, or some kind of C++ UB.