Skip to content

Instantly share code, notes, and snippets.

View yangshun's full-sized avatar
😎
Ruining websites since 2013

Yangshun Tay yangshun

😎
Ruining websites since 2013
View GitHub Profile
@yangshun
yangshun / README-Template.md
Created March 3, 2017 13:53 — forked from PurpleBooth/README-Template.md
A template to make good README.md

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.

Prerequisites

(() => {
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
yangshun / whatsapp_phone_enumerator_floated_div.js
Created May 12, 2017 11:26
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
/*
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
01-05-2017
(c) 2017 - Loran Kloeze - loran@ralon.nl
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
yangshun / mp4-to-mp3.sh
Last active September 18, 2017 02:21
Converts mp4 to mp3 format.
# Place the ffmpeg binary in the same directory.
for video_file in *.mp4
do
audio_file="${video_file/.mp4/.mp3}"
if [ -f "$audio_file" ]; then
echo "$audio_file exists."
else
echo "Converting $video_file to $audio_file."
./ffmpeg -i "$video_file" -vn -sn -c:a mp3 -ab 192k "$audio_file"
fi
module.exports = (babel) => {
const { types: t } = babel;
const GLOBAL_EXPOSURE_IDENTIFIER = 'babelPluginExportPrivates';
const HOIST_PRAGMA = 'babel-plugin-export-privates';
const identifiers = new Set();
function attachToGlobalObject(path, identifierName) {
identifiers.add(identifierName);
// Attach to global object to be exposed for exporting later.
path.insertAfter(
@yangshun
yangshun / coursera-answers.js
Last active April 6, 2018 12:59
For sharing your Coursera quiz answers with your friends
// Steps to share Coursera Quiz answers
// =====
// 1. Open the web developer console. In Chrome, press ctrl/cmd + shift + J, in Firefox, press ctrl/cmd + shift + K
// 2. Copy the following code below and paste it in the console. Press enter.
// 3. Your answers will be printed out and you can share it with other people (:
//
(function () {
var answer = '\n';
@yangshun
yangshun / eslint-error-formatter.js
Last active June 30, 2018 11:02
Output all the violating rules as an array for turning off and turning on incrementally
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;
});
});
@yangshun
yangshun / MFCC.py
Last active October 12, 2018 07:44
Computes the MFCC (Mel-frequency cepstrum coefficients) of a sound wave
import random
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
import time
import os
from math import *
from numpy import append, zeros
from scipy.io import wavfile

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

Requirements

  • No build requirements
  • Small and lightweight