Skip to content

Instantly share code, notes, and snippets.

View tientq64's full-sized avatar
🧋
Chill with code

Tran Quang Tien tientq64

🧋
Chill with code
View GitHub Profile
Math.rand = function(a , b) {
if (b === undefined)
[a, b] = [0, a];
if (a > b)
[a, b] = [b, a];
return Math.floor(a + Math.random() * (Math.abs(b - a) + 1));
};
Array.prototype.rand = function() {
return this[Math.floor(Math.random() * this.length)];
@tientq64
tientq64 / index.html
Created June 17, 2018 01:46
Untitled benchmark #jsbench #jsperf (http://jsbench.github.io/#28ab2492efc697728cdd2bc71e945957) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@tientq64
tientq64 / index.pug
Created February 22, 2021 14:16
Zdog — Natu (Pokémon)
doctype html
canvas#canvas
@tientq64
tientq64 / cub-n-pup-puzzle-game-demo.markdown
Created February 22, 2021 14:43
Cub n Pup - puzzle game demo

Cub n Pup - puzzle game demo

How to play: Drag cub to star, Drag grid to rotate.

Also available at cubnpup.com

This is a proof-of-concept for a game. Basic art, no sound, no options, no polish. But the core game-play is there. It's more of a mobile game, focused on dragging — inspired by Threes. I'm looking to see if its any fun. Let me know!

I've always wanted to make a video game. This could be the one. My previous attempts never got past isolated demos because they were aiming for bigger ideas. They grew complex and unwieldy. So this game is designed to be simple. A game that I can actually make.

@tientq64
tientq64 / drag-and-drop-succulent-garden-solution.markdown
Created February 22, 2021 14:51
Drag-and-Drop Succulent Garden : Solution

Drag-and-Drop Succulent Garden : Solution

One solution to the Drag and Drop Succulent Garden - Project Outline posted for the Creative Coding Club.

A Pen by Nat Cooper on CodePen.

License.

min + Math.floor(Math.random() * (max - min + 1))
@tientq64
tientq64 / add.js
Last active October 22, 2023 14:57
Add 2 numbers, fix floating point problem, example: 0.1 + 0.2, not support Node.js :Đ
function add(a, b) {
if (a === 0) return b;
if (b === 0) return a;
let sign = 1;
if (a < 0 && b < 0) {
a = -a;
b = -b;
sign = -1;
}
if (b < 0) {

[game] Copycat

Little update, I've updated the visuals during the translation and cleaning of the code :) Made with Diorama

A Pen by Tibo on CodePen.

License.

(6 * 9) + (6 + 9) == 69
Mỹ nhân trong thiên hạ đều tầm thường, chỉ có JavaScript mới làm ta thích thú 😂