Skip to content

Instantly share code, notes, and snippets.

😑
Raising Dinos 🦖

Yangshun Tay yangshun

😑
Raising Dinos 🦖
Block or report user

Report or block yangshun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am yangshun on github.
  • I am yangshun (https://keybase.io/yangshun) on keybase.
  • I have a public key ASALzkiMtwtQ1tT2loY5YKoN54yysqWWF7TLUB8ai024BAo

To claim this, I am signing this object:

View useInputValue.js
'use strict';
const {useCallback, useState} = require('React');
const nullthrows = require('nullthrows');
type InputValue<T> = {|
// Whether the input value has changed since it was initialized.
changed: boolean,
// A string key to uniquely identify the value.
View prepend-copyright.sh
@yangshun
yangshun / docusaurus-copy-button.md
Last active Jul 23, 2019
How to add the "Copy" button to code blocks in Docusaurus
View docusaurus-copy-button.md

Adding "Copy" (to Clipboard) Button

If you would like to add a button to your fenced code blocks so that users may copy the code, you can do so in Docusaurus. You will have to add some code to your Docusaurus project, as seen below.

Under static/js, create a file called code-block-buttons.js with the following:

// Turn off ESLint for this file because it's sent down to users as-is.
/* eslint-disable */
window.addEventListener('load', function() {
View babel-plugin-export-private.js
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(
View nusmods.md
View leetcode-questions-list.js
let res = '';
$('#question_list tbody tr').each(function () {
const $td = $(this).find('td');
const $link = $($td[2]).find('a').first();
res += `[${$($td[1]).text().trim()} - ${$link.text()}](https://leetcode.com${$link.attr('href')})\n`;
});
console.log(res);
@yangshun
yangshun / mp4-to-mp3.sh
Last active Sep 18, 2017
Converts mp4 to mp3 format.
View mp4-to-mp3.sh
# 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
@yangshun
yangshun / job-hunting.md
Last active Oct 30, 2019
Some resources for the job hunting season
View job-hunting.md

Tech Job Hunting

Mock Interview Sites

Would advise you all to practice just for fun. I know a lot of students don't get much practice for interviews.

  • interviewing.io - Allows you to have mock interviews with engineers from the bay area (so they say, but I am an interviewer on the platform too). I personally like this platform a lot and used it both as an interviewee and an interviewer.
  • Pramp - Peer-to-peer mock interviews. You get matched with another person, get assigned questions and take turns to be interviewer/interviewee. I personally dislike this platform a lot because I had a horrible experience being matched with some guy who didn't know shit about regular expressions, gave me a wrong test case, and led me down the wrong path of solving the question.
You can’t perform that action at this time.