Skip to content

Instantly share code, notes, and snippets.

View RuyiLi's full-sized avatar
🐶
if id ex mem wb

Roy Li RuyiLi

🐶
if id ex mem wb
View GitHub Profile
@RuyiLi
RuyiLi / chitest.py
Last active December 31, 2018 18:22
Scripts used in my Math IA
import os
import pandas
from scipy import stats
# 3-digit team code
# This code is the same regardless of sport, just change the teams
teams = ['ari', 'atl', 'bal', 'bos', 'chc', 'chw', 'cin', 'cle', 'col', 'det', 'hou', 'kcr', 'laa', 'lad', 'mia', 'mil', 'min', 'nym', 'nyy', 'oak', 'phi', 'pit', 'sd', 'sea', 'sf', 'stl', 'tb', 'tex', 'tor', 'wsn']
indices = [ 'Win', 'Loss', 'Total' ]
@RuyiLi
RuyiLi / .eslintrc.json
Last active July 1, 2019 22:32
my eslint and ts config
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"parser": "@typescript-eslint/parser",
"plugins": [
@RuyiLi
RuyiLi / assignments.md
Last active August 5, 2019 13:10
Lesson 6 Assignment

For all assignments, make sure to clearly label your local and global variables. Use functions to make your code more easy-to understand.

Assigment 1 - Shopping Cart

Create an application with an input field and a submit field. When the submit button is pressed, the text in the input should be added to a "shopping cart" (an unordered list). This is similar to your wishlist application. Try not to just copy code from the wishlist project, as there's literally no point in cheating on this.

Assignment 2 - Color a Square

Create 5 buttons labelled "red", "blue", "green", "white", and "black". When pressed, the background of a div element

@RuyiLi
RuyiLi / assignments2.md
Created August 6, 2019 02:19
More Assignments

Assignment 1 - Age

Create an input with type="date". When a button is pressed, the program should write "You are $(age) years old" into a paragraph element. Replace $(age) with the number of years since the date entered.

Use the MDN Docs for the Date object to complete this assignment: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

You can get a date object from the input by doing new Date(input.value).

Assignment 2 - Move a Square

@RuyiLi
RuyiLi / assignments3.md
Last active August 7, 2019 14:43
Big Assignments

Make sure to use styles!

Choice 1 - Rock Paper Scissors Poker

Rules of the game:

Each player draws five cards (either rock, paper, or scissors) from an unlimited deck. Both players will pick one card, and if one player's cards beat the other (rock beats scissors, paper beats rock, scissors beats paper) then that player wins. If there is a tie (e.g. both play rock) then whoever has more of the chosen card in the hand wins. If they both have the same amount, it is counted as a tie.

As an extra challenge, modify the game so that there are 5 rounds, with a point being awarded each time a player wins. At the end of the five rounds, print the status of the game (either a win, tie, or a loss).

@RuyiLi
RuyiLi / index.html
Created September 4, 2019 17:37
argebe - A fun and unique browser game smaller than 3kb (uncompressed, without comments)
<canvas style="position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);"></canvas>
<script>
/*
w - The width of the canvas in pixels.
h - The height of the canvas in pixels.
s - The size of the character in pixels.
c - The canvas element.
t - The graphics context.
u - The available colors.
q - The player's current colors.
@RuyiLi
RuyiLi / goosegen.js
Created September 15, 2019 01:06
LONGOOSE
g=a=>`:goose-${a}:`;[g('top'),...Array(+prompt('Length of goose neck:')).fill(g('middle')),g('bottom')].join`\n`

Keybase proof

I hereby claim:

  • I am ruyili on github.
  • I am wecryopen (https://keybase.io/wecryopen) on keybase.
  • I have a public key ASBErN8SGkckrb14D073PzIuuJUwbAoEmXSnAFQKiNEYFgo

To claim this, I am signing this object:

@RuyiLi
RuyiLi / index.html
Created December 9, 2019 03:14
Soldier simulator application for my Math Extended Essay.
<canvas></canvas>
<button onclick="josephus()"> Start </button>
<button onclick="eliminate()"> Kill </button>
<script>
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
const SIZE = 640;
canvas.width = canvas.height = SIZE;
@RuyiLi
RuyiLi / main.jl
Last active January 21, 2020 13:28
Calculating the value of Pi in Julia - Google Code-In
# Author: Ruyi Li (weCryOpen)
function mypi(n::Int)::Float
total_sum::Float = 0
for i = 1:n
total_sum += 1 / (i * i)
end
(total_sum * 6) ^ 0.5
end