Skip to content

Instantly share code, notes, and snippets.

@Teddarific
Teddarific / gist:41fe4f4a3203894a1949cb41e9ee48d8
Created January 2, 2025 21:31
Player Profile Tiles with Gradient Design
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tennis Stats</title>
<style>
/* Reset and base styles */
* {
margin: 0;
function wo(e, r) {
for (var n = 0; n < r.length; n++) {
const a = r[n];
if (typeof a != "string" && !Array.isArray(a)) {
for (const s in a)
if (s !== "default" && !(s in e)) {
const u = Object.getOwnPropertyDescriptor(a, s);
u && Object.defineProperty(e, s, u.get ? u : {
enumerable: !0,
get: () => a[s]
/* NOTE(teddy):
This code is heavily dependent on browser APIs, so must be run in a browser (e.g. as part of a React app)
It basically has an input that takes an image, shows a preview, and you can do whatever you want
with it once it's in state!
*/
// NOTE(teddy): Which file types to accept - not necessary to add this.
const VALID_MEDIA_UPLOAD_MIME_TYPES = ['image/jpeg', 'image/png', 'image/heic']
function ImageUploader(){
/*
Simulate a Mouse Event
*/
//Target: element this event should be dispatched on
//Type: What type of mouse event, e.g. "click"
//Button: //0: Left (Default) 1: Middle 2:Right
var simulateMouseEvent = function(target,type,button){
button = button || 0; //default is left click
var evt = new MouseEvent(type,{
@Teddarific
Teddarific / main.html
Created December 20, 2015 01:21
Home page for a stock portfolio manager (CSS not included)
<!DOCTYPE HTML>
<html>
<head>
<title>Stock Portfolio Manager</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link type = "text/css" rel="stylesheet" href = "homeDesign.css"/>
<script>
$(document).ready(function(){
$('#doneEditButton').hide();
@Teddarific
Teddarific / read_file.php
Created December 20, 2015 01:20
A PHP file that given a name of a text file, will read the file line by line.
<?php
$portName = $_POST['name'];
$file = $portName . ".txt";
unlink($file);
$data = file("homeFile.txt", FILE_IGNORE_NEW_LINES);
$homeFile = fopen("homeFile.txt",w);
unset($data[0]);
$data = array_values($data);
foreach ($data as $temp){
@Teddarific
Teddarific / check_username.php
Created December 20, 2015 01:10
Basic Register/Login system that uses a SQL database (No encryption is used).
<?php
$username = $_POST['Username'];
$sql_svs = '127.0.0.1:8889';
$data_nm = 'userinfo';
$data_user = 'user_info_user';
$data_pd = 'userinfo';
$link = mysql_connect('127.0.0.1:8889',$data_user,$data_pd);
if(!$link){
die('Could not connect to database');
}
@Teddarific
Teddarific / MyAVLMap.java
Created December 20, 2015 01:03
An AVL search tree implementation in Java. The tree implements a BST (Binary Search Tree), which implements a basic map ADT.
/**
* MyAVLMap
* Implementation for an AVL Map that extends a BST tree
* Supports the functions of insert, find, and size
* @author Teddy Ni
*/
public class MyAVLMap extends MyBSTMap{
/**
@Teddarific
Teddarific / home.html
Created December 20, 2015 00:56
HTML/CSS/JavaScript/JQuery Code that serves as the basic framework for a commenting/posting page. Also, has a static vertical navigation bar to right of the screen.
<!DOCTYPE HTML>
<html>
<head>
<title>Event Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#post').click(function(){
var username = $('#username').val();