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

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@yangshun
yangshun / emoticon-emoji.json
Created January 17, 2017 07:07
Mapping of common emoticons to their respective emojis
{
":)": "🙂",
":-)": "🙂",
"(:": "🙂",
":D": "😄",
":-D": "😄",
"=D": "😃",
"=-D": "😃",
":')": "😂",
":'-)": "😂",
@yangshun
yangshun / media-rename.sh
Created October 2, 2016 07:48
Rename .webm files to .mp4
#/usr/bin/sh
for f in *.webm; do
mv -- "$f" "${f%.webm}.mp4"
done
@yangshun
yangshun / deep-dive-into-nusmods.md
Last active November 20, 2018 21:28
An explanation of how the timetabling algorithm of NUSMods works

Deep Dive into NUSMods

Ever wondered how the timetabling algorithm of NUSMods works? Read on to find out.

Firstly start let's define the data representation of a Lesson:

Lesson = {
  ClassNo: string,
 DayText: string,
@yangshun
yangshun / Gulpfile.js
Created August 11, 2016 13:00
Static web server with styles watching
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var webserver = require('gulp-webserver');
gulp.task('sass', function () {
return gulp.src('./sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'));
var script = document.createElement('script');
script.src = '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js';
script.onload = function () {
// Do something
}
document.getElementsByTagName('head')[0].appendChild(script);
## Directory structure:
## dir
## |-- gen_runes.py
## |-- graphics.py
## |-- PyGif.py
## +-- runes.py
## Put submissions in the same directory as this file.
## Make sure there are no other .py files besides
## the submissions and the whitelisted files
@yangshun
yangshun / fix-wordpress-permissions.sh
Created January 21, 2016 16:41 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@yangshun
yangshun / country-code.js
Created December 29, 2015 05:49
Country Code Scraper
// From http://www.science.co.il/International/Country-codes.asp
var data = {};
var trs = document.querySelectorAll('table.sortable tbody tr');
for (var i = 0; i < trs.length; i++) {
var item = trs[i];
var tds = item.querySelectorAll('td');
data[tds[2].textContent] = {
name: tds[0].textContent,
// "body-parser": "^1.4.3",
// "express": "^4.4.5",
// "request": "^2.67.0"
var fs = require('fs');
var path = require('path');
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var http = require('http');