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 java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class Main extends JPanel implements ActionListener, KeyListener { | |
private Timer timer; | |
private int playerX, playerY, playerVelocityY; | |
private boolean isJumping, isMovingLeft, isMovingRight; | |
private static final int PLAYER_WIDTH = 50; | |
private static final int PLAYER_HEIGHT = 50; |
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
genai.configure(api_key=os.environ['GOOGLE_API_KEY']) |
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
// Select all forms on the page | |
const forms = document.querySelectorAll('form'); | |
// Iterate over each form and attach a submit event listener | |
forms.forEach(form => { | |
form.addEventListener('submit', event => { | |
event.preventDefault(); // Prevent the default form submission behavior | |
// Get form data | |
const formData = new FormData(form); |
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 http.server import BaseHTTPRequestHandler, HTTPServer | |
import json | |
class MyRequestHandler(BaseHTTPRequestHandler): | |
def _set_headers(self, status_code=200, content_type='text/html'): | |
self.send_response(status_code) | |
self.send_header('Content-type', content_type) | |
self.end_headers() | |
def do_GET(self): |
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 Phaser from "phaser"; | |
function preload() { | |
this.load.image("sky", "Assets/sky.png"); | |
this.load.image("ground", "Assets/platform.png"); | |
this.load.image("star", "Assets/star.png"); | |
this.load.image("bomb", "Assets/bomb.png"); | |
this.load.spritesheet("dude", "Assets/dude.png", { | |
frameWidth: 32, | |
frameHeight: 48, |
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
// This code takes values put in to column A, and applies a formula to calculate column B. | |
// The result of the formula, not the formula, is added to column B. | |
function onEdit(e) { | |
var range = e.range; | |
var sheet = range.getSheet(); | |
var row = range.getRow(); | |
var col = range.getColumn(); | |
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
function stringToNumber(inputString) { | |
let hash = 0; | |
for (let i = 0; i < inputString.length; i++) { | |
const charCode = inputString.charCodeAt(i); | |
hash = (hash << 5) - hash + charCode; | |
} | |
hash = Math.abs(hash); | |
return hash; | |
} |
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
function myFunction() { | |
let sheet = SpreadsheetApp.getActiveSheet(); | |
let address = sheet.getRange("A1").getValue(); | |
let subject = sheet.getRange("A2").getValue(); | |
let body = sheet.getRange("A3").getValue(); | |
MailApp.sendEmail(address, subject, body); | |
} |
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 pandas as pd | |
import requests | |
import re | |
def get_final_url(url): | |
response = requests.get(url, allow_redirects=True) | |
return response.url | |
# Load the CSV file | |
file_path = 'sf housing - list.csv' |
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 { initializeApp } from "firebase/app"; | |
import { getFirestore, collection, getDocs } from 'firebase/firestore/lite'; | |
import { getAuth, signInWithCustomToken } from "firebase/auth"; | |
import { firebaseConfig } from "../config/firebase" | |
import { useAuth } from "@clerk/clerk-react"; | |
import { useEffect, useState } from "react"; | |
// Initialize Firebase app with the provided configuration |
NewerOlder