class RacingGame:
def __init__(self, width, height, road_width):
self.width = width
self.height = height
self.road_width = road_width
self.car_position = width // 2 + 1 # Adjusted to stay on the right
self.road_offset = 0
self.road_direction = 1
self.game_over = False
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { writable } from 'svelte/store'; | |
import { onMount } from 'svelte'; | |
// Declare reactive stores | |
const primesStore = writable([]); | |
const progressStore = writable(0); | |
const timeStore = writable(0); | |
let isRunning = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User, [5/3/24 1:17 PM] | |
Create 10 sentences that ends with the word "apple". Remember the word "apple" MUST be at the end. | |
AI, [5/3/24 1:17 PM] | |
1. After a long day of work, I enjoy a refreshing glass of apple juice. | |
2. The story of Snow White and her poisoned apple is a classic tale known worldwide. | |
3. In the garden, the red and green apples hang from the branches, ripe and juicy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
from bs4 import BeautifulSoup | |
from nltk.tokenize import sent_tokenize, word_tokenize | |
from playwright.sync_api import sync_playwright | |
MAX_CONTEXT_SIZE = 8000 | |
OVERLAP_TOKENS = 100 | |
def fetch_html(url): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'ruby2d' | |
# This class represents the game board. | |
class Board | |
attr_accessor :cells | |
def initialize | |
@cells = Array.new(3) { Array.new(3, '') } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from playwright.sync_api import sync_playwright | |
from bs4 import BeautifulSoup | |
def extract_data(page_content): | |
soup = BeautifulSoup(page_content, 'html.parser') | |
series_list = ["EX Series Ethernet Switches", "ACX Series Service Routers", | |
"J Series Service Routers", "QFX Series Service Routers", | |
"SRX Series Services Gateways"] | |
for series in series_list: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "rust-lavalamp" | |
version = "0.1.0" | |
edition = "2018" | |
# Dependencies | |
[dependencies] | |
rand = "0.8" | |
ncurses = "5.101.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let e=e=>new Promise(t=>setTimeout(t,e)),c=e=>e.charCodeAt(),a=e=>"Arrow"+e,k=e=>{let t=new KeyboardEvent("keydown",{key:e,code:e,keyCode:c(e),which:c(e)});document.dispatchEvent(t)},t=(t,o)=>e(t).then(()=>k(a(o))),l=async()=>{for(let e=0;e<1e9;e++)await t(30,"Left"),await t(720,"Up"),await t(30,"Right"),await t(780,"Up")};e(90).then(l); |
Creating a simple on-page JavaScript console or REPL can be achieved with a combination of HTML, CSS, and JavaScript. You can use localStorage
to maintain state between sessions. Here's a basic implementation that you can use as a starting point and modify to fit your needs:
- First, create the HTML structure for your on-page console:
<!DOCTYPE html>
<html lang="en">
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "snake" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
piston_window = "0.128.0" | |
rand = "0.8.5" |
NewerOlder