Skip to content

Instantly share code, notes, and snippets.

View ethanny2's full-sized avatar
👾
Shaders?

Ethan Soo Hon ethanny2

👾
Shaders?
View GitHub Profile
@ethanny2
ethanny2 / The Technical Interview Cheat Sheet.md
Created February 20, 2021 01:36 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@ethanny2
ethanny2 / doubleTap.js
Created May 27, 2020 00:46
Vanilla JavaScript Double tap event detection on mobile using setTimeout
/* Based on this http://jsfiddle.net/brettwp/J4djY/*/
function detectDoubleTapClosure() {
let lastTap = 0;
let timeout;
return function detectDoubleTap(event) {
const curTime = new Date().getTime();
const tapLen = curTime - lastTap;
if (tapLen < 500 && tapLen > 0) {
console.log('Double tapped!');
event.preventDefault();
@ethanny2
ethanny2 / async.js
Created February 23, 2020 02:25
Handle asynchronous HTTP promises synchronously with async/await. Example using Pokemon API (https://pokeapi.co/)
let urlBase = "https://pokeapi.co/api/v2/pokemon/"
const sampleGet = async (pokemonName) => {
let response = await fetch(urlBase + pokemonName);
let parsedJson = await response.json();
document.body.innerHTML = `<img alt="default front sprite for starmie" src=${parsedJson.sprites.front_default} >`;
}
sampleGet("starmie");
@ethanny2
ethanny2 / Tic-Tac -Toe C++
Created May 14, 2014 02:41
A sample Tic Tac Toe program I made without a GUI, when I started with C++
#include <iostream>
using namespace std;
int main()
{
const int ROWS=3;
const int COLUMNS=3;
char board[ROWS][COLUMNS]={{'1','2','3'},