Skip to content

Instantly share code, notes, and snippets.

I'm nitpicky!

Yangshun Tay yangshun

I'm nitpicky!
View GitHub Profile
yangshun / tic-tac-toe.html
Last active Apr 28, 2019
Tic-tac-toe game in Vanilla JS
View tic-tac-toe.html
<!doctype html>
body {
font-family: 'Helvetica', sans-serif;
.board-cell {
border: 1px solid #666;
box-sizing: border-box;

Connect 4

Connect 4 is a game where two players aim to connect up their pieces to make 4 in a row. Each player takes turn to choose a column to drop their pieces. The first player to connect 4 pieces in a row wins the game. Player 1's pieces are represented by X and Player 2 by O. The game will start with player 1 first. The board dimensions is 6 x 7. Your cli game will have to prompt the user to enter the column number (1-based) that they want to place the next piece in.

yangshun /
Last active Dec 24, 2020
Comparison between tools that allow you to use ESLint and Prettier together.
prettier-eslint eslint-plugin-prettier eslint-config-prettier
What it is A JavaScript module exporting a single function. An ESLint plugin. An ESLint configuration.
What it does Runs the code (string) through prettier then eslint --fix. The output is also a string. Plugins usually contain implementations for additional rules that ESLint will check for. This plugin uses Prettier under the hood and will raise ESLint errors when your code differs from Prettier's expected output. This config turns off formatting-related rules that might conflict with Prettier, allowing you to use Prettier with other ESLint configs like eslint-config-airbnb.
How to use it Either calling the function in your code or via [prettier-eslint-cli](
yangshun / whatsapp_phone_enumerator_floated_div.js
Created May 12, 2017 — forked from LoranKloeze/whatsapp_phone_enumerator_floated_div.js
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
View whatsapp_phone_enumerator_floated_div.js
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
(c) 2017 - Loran Kloeze -
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds
of information from a range of phonenumbers. It doesn't matter if these numbers are part
of your contact list. At the end a table is displayed containing phonenumbers, profile pics,
about texts and online statuses. The online statuses are being updated every
yangshun / eslint-error-formatter.js
Last active Jun 30, 2018
Output all the violating rules as an array for turning off and turning on incrementally
View eslint-error-formatter.js
module.exports = function (results) {
const rulesFreqs = {};
results.forEach(file => {
file.messages.forEach(message => {
if (!rulesFreqs[message.ruleId]) {
rulesFreqs[message.ruleId] = 0;
rulesFreqs[message.ruleId] += 1;

Problems faced by Grab UI

  1. Not possible to have project specific overrides of variables
  2. CSS modules not specific enough to override Grab UI (Semantic UI) classes as CSS modules only apply one class where Semantic UI applies two classes (.ui.) and has higher specificity.
  3. Import theme variables from Grab UI theme configs to use in project-specific components


  • No build requirements
  • Small and lightweight
View react-semantic-ui-scraping.js
(() => {
const storySubtitle = $$('.sub.header')[0].textContent;
const storyTitle = $$('h1.header')[0].textContent.replace(storySubtitle, '');
const chapters = [];
[...$$('div[data-reactroot]')[0].children[1].children[0].children[1].children].forEach(chapterEl => {
const chapterObject = { title: null, sections: [] };
const chapterChildren = chapterEl.children[0].children;
chapterObject.title = chapterChildren[0].textContent;
yangshun /
Created Mar 3, 2017 — forked from PurpleBooth/
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.



Security is Hard

Massive Assignment

  • watch for ActiveRecord Relation, like has_many, has_many :through
  • watch for user_roles, `group_users
  • UPDATE action


View telegram.js
// Name animater
var name = 'Yang.Shun.Tay.';
setInterval(function () {
name = name.substring(1) + name.charAt(0);
var flags = (1 << 0) | (1 << 1);
MtpApiManager.invokeApi('account.updateProfile', {
flags: flags,
first_name: name,
last_name: ''